def resolve(self, definitions): """ Resolve named references to other WSDL objects. @param definitions: A definitions object. @type definitions: L{Definitions} """ for op in self.operations.values(): if op.input is None: op.input = Message(Element("no-input"), definitions) else: qref = qualify(op.input, self.root, definitions.tns) msg = definitions.messages.get(qref) if msg is None: raise Exception("msg '%s', not-found" % (op.input, )) op.input = msg if op.output is None: op.output = Message(Element("no-output"), definitions) else: qref = qualify(op.output, self.root, definitions.tns) msg = definitions.messages.get(qref) if msg is None: raise Exception("msg '%s', not-found" % (op.output, )) op.output = msg for f in op.faults: qref = qualify(f.message, self.root, definitions.tns) msg = definitions.messages.get(qref) if msg is None: raise Exception("msg '%s', not-found" % (f.message, )) f.message = msg
def resolveheaders(self, definitions, op): """ Resolve SOAP header I{message} references. @param definitions: A definitions object. @type definitions: L{Definitions} @param op: An I{operation} object. @type op: I{operation} """ soap = op.soap headers = soap.input.headers + soap.output.headers for header in headers: mn = header.message ref = qualify(mn, self.root, definitions.tns) message = definitions.messages.get(ref) if message is None: raise Exception("message '%s', not-found" % (mn, )) pn = header.part for p in message.parts: if p.name == pn: header.part = p break if pn == header.part: raise Exception("message '%s' has not part named '%s'" % (ref, pn))
def resolveport(self, definitions): """ Resolve port_type reference. @param definitions: A definitions object. @type definitions: L{Definitions} """ ref = qualify(self.type, self.root, definitions.tns) port_type = definitions.port_types.get(ref) if port_type is None: raise Exception("portType '%s', not-found" % (self.type, )) self.type = port_type
def resolve(self, definitions): """ Resolve named references to other WSDL objects. Ports without SOAP bindings are discarded. @param definitions: A definitions object. @type definitions: L{Definitions} """ filtered = [] for p in self.ports: ref = qualify(p.binding, self.root, definitions.tns) binding = definitions.bindings.get(ref) if binding is None: raise Exception("binding '%s', not-found" % (p.binding, )) if binding.soap is None: log.debug("binding '%s' - not a SOAP binding, discarded", binding.name) continue p.binding = binding filtered.append(p) self.ports = filtered
def __getref(self, a, tns): """Get the qualified value of attribute named 'a'.""" s = self.root.get(a) if s is not None: return qualify(s, self.root, tns)