⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 biwsdl.py

📁 ajax 框价.是个好工具.javascript 矿家.可以用在任何平台.
💻 PY
📖 第 1 页 / 共 2 页
字号:
from xml.dom.minidom import *import reimport urllibimport loggingimport urlparseimport itertoolsfrom BiWsdlCodeGen import *BiWsdlLogger = logging.getLogger("BiWsdl")"""<summary>The BiWsdlService class represents a service definition within a WSDL file.</summary>"""class BiWsdlService:   """   <summary>   BiWsdlService constructor.   </summary>   <param name="aSrcElement">Source DOM wsdl:service element from which object data should be loaded. </param>   <param name="aWsdl">Owner BiWsdl object </param>   """   def __init__(self, aSrcElement, aWsdl):      # Get name of service      self.__name = "[" + aWsdl.getTargetNamespace() + "]" + aSrcElement.getAttribute("name")            # If we have a wsdl:documentation node, keep it.      lDocNodes = aSrcElement.getElementsByTagNameNS(BiWsdl.WSDL_NS, "documentation")      if lDocNodes.length>0: self.__docNode = lDocNodes[0]      # Prepare data structures to hold data on ports      self.__portNames = []      self.__portNodes = {}      self.__portBindings = {}      # Load port data from port elements       for lPortNode in aSrcElement.getElementsByTagNameNS(BiWsdl.WSDL_NS, "port"):          lPortName = lPortNode.getAttribute("name")          self.__portNames.append(lPortName)          self.__portNodes[lPortName]=lPortNode          lPortBindingName = expandQName(lPortNode.getAttribute("binding"), lPortNode)          self.__portBindings[lPortName]=aWsdl.getBindings().getDefinition(lPortBindingName)   """   <summary>   Return sequence of names of ports in service.   </summary>   """   def getPortNames(self):      return self.__portNames   """   <summary>   Get BiWsdlBinding object for service port, by port's name   </summary>   <param name="aPortName">Name of port to retrieve binding for</param>   """   def getPortBinding(self, aPortName):      return self.__portBindings[aPortName]   """   <summary>   Retrieve the DOM node defining a port, by the port's name.   </summary>   <param name="aPortName"> Name of port to retrieve DOM node for</param>   """   def getPortDefinitionNode(self, aPortName):      return self.__portNodes[aPortName]    """   <summary>   Return port's name.      </summary>   """   def getName(self):      return self.__name"""<summary>BiWsdlBinding represents a binding definition within a WSDL file.</summary>"""class BiWsdlBinding:   """   <summary>   Constructor. Initialize a binding object.      </summary>   <param name="aSrcElement">Source wsdl:binding DOM object from which binding object should be loaded. </param>   <param name="aWsdl">Parent BiWsdl object.</param>   """   def __init__(self, aSrcElement, aWsdl):      lPortTypeName = expandQName(aSrcElement.getAttribute("type"), aSrcElement)      self.__portType = aWsdl.getPortTypes().getDefinition(lPortTypeName)   """   <summary>   Get port type associated with binding.   </summary>   """   def getPortType(self):      return self.__portType"""<summary>BiWsdlPortOperation represents an operation defined within a port definition in a WSDL.</summary>"""class BiWsdlPortOperation:   # Operation type constants   OPTYPE_ONE_WAY = "one-way"   OPTYPE_NOTIFICATION = "notification"   OPTYPE_REQUEST_RESPONSE = "request-response"   OPTYPE_SOLICIT_RESPONSE = "solicit-response"   """   <summary>   Constructor.   </summary>   <param name="aPortType">BiWsdlPortType to which this operation belongs. </param>   <param name="aSrcElement">Source wsdl:operation DOM element from which this object should be loaded. </param>   """   def __init__(self, aPortType, aSrcElement):      # Devise type of operation (one-way/two-way/....)      lChildren = aSrcElement.getElementsByTagNameNS(BiWsdl.WSDL_NS, "*")      lNumNonFaultChildren = lChildren.length      lHasFault = getQNameLocalPart(lChildren[lChildren.length-1].tagName)=="fault"            if lHasFault: lNumNonFaultChildren = lNumNonFaultChildren - 1      if lNumNonFaultChildren==1:         if getQNameLocalPart(lChildren[0].tagName)=="input": self.__opType=BiWsdlPortOperation.OPTYPE_ONE_WAY         elif getQNameLocalPart(lChildren[0].tagName)=="output": self.__opType=BiWsdlPortOperation.OPTYPE_NOTIFICATION         else: raise "Invalid tag within wsdl:operation."      elif lNumNonFaultChildren==2:         if getQNameLocalPart(lChildren[0].tagName)=="input": self.__opType=BiWsdlPortOperation.OPTYPE_REQUEST_RESPONSE         elif getQNameLocalPart(lChildren[0].tagName=="output"): self.__opType=BiWsdlPortOperation.OPTYPE_SOLICIT_RESPONSE         else: raise Exception("Invalid tag within wsdl:operation (" + lChildren[0].tagName + ")")      else: raise Exception("Invalid number of elements within wsdl:operation (" + aSrcElement.getAttribute("name") + ")")      # Get input message, if applicable      lInputElement = aSrcElement.getElementsByTagNameNS(BiWsdl.WSDL_NS, "input")[0]      if lInputElement:         lInputMessageName = expandQName(lInputElement.getAttribute("message"), lInputElement)         self.__inputMessage = aPortType.getWsdl().getMessages().getDefinition(lInputMessageName)      # Get output message, if applicable      lOutputElement = aSrcElement.getElementsByTagNameNS(BiWsdl.WSDL_NS, "output")[0]      if lOutputElement:         lOutputMessageName = expandQName(lOutputElement.getAttribute("message"), lOutputElement)         self.__outputMessage = aPortType.getWsdl().getMessages().getDefinition(lOutputMessageName)   """   <summary>   Get operation type. This is returned as one of the OPTYPE_xxx constants.   </summary>   """   def getOpType(self):      return self.__opType   """   <summary>   Get input message. This returns a BiWsdlMessage representing the input message for the operation.   </summary>   """   def getInputMessage(self):      return self.__inputMessage   """   <summary>   Get output message. This returns a BiWsdlMessage representing the output message for the operation.   </summary>   """   def getOutputMessage(self):      return self.__outputMessage"""<summary>The BiWsdlPortType class represents a WSDL port type.</summary>"""class BiWsdlPortType:   """   <summary>   Construct a port type object from a WSDL node.   </summary>   <param name="aSrcElement">Source wsdl:portType DOM node from which object should be constructed </param>   <param name="aWsdl">Parent BiWsdl object for port type. </param>   """   def __init__(self, aSrcElement, aWsdl):      self.__wsdl = aWsdl      self.__operationNames = []      self.__operations = {}      # Load operations      for lOperationTag in aSrcElement.getElementsByTagNameNS(BiWsdl.WSDL_NS, "operation"):         lOpName=lOperationTag.getAttribute("name")         self.__operationNames.append(lOpName)         self.__operations[lOpName] = BiWsdlPortOperation(self, lOperationTag)   """   <summary>   Get sequence of names of operations defined for this port type.   </summary>   """   def getOperationNames(self):      return self.__operationNames   """   <summary>   Get BiWsdlPortOperation object for an operation defined within this port, by the operation's name.   </summary>   <param name="aOpName">Name of operation to retrieve</param>   """   def getOperation(self, aOpName):      return self.__operations[aOpName]   """   <summary>   Get BiWsdl object owning this port definition.   </summary>   <param name="self"> </param>   """   def getWsdl(self):      return self.__wsdl"""<summary>BiWsdlMessagePart represents a WSDL message part.</summary>"""class BiWsdlMessagePart:   """   <summary>   Constructor.   </summary>   <param name="aMessage">Owner BiWsdlMessage of this message part</param>   <param name="aElement">wsdl:part DOM element from which message part object should be loaded</param>   """   def __init__(self, aMessage, aElement):      if aElement.getAttribute("type"):         self.__type = expandQName(aElement.getAttribute("type"), aElement);      elif aElement.getAttribute("element"):         self.__type = expandQName(aElement.getAttribute("element"), aElement);      """   <summary>   Return type/element of message part   </summary>   """   def getType(self):      return self.__type"""<summary>BiWsdlMessage represents a WSDL message definition.</summary>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -