def checkWSDLCollection(self, tag_name, component, key='name'): if self.wsdl is None: return definition = self.wsdl.document.documentElement version = DOM.WSDLUriToVersion(definition.namespaceURI) nspname = DOM.GetWSDLUri(version) for node in DOM.getElements(definition, tag_name, nspname): name = DOM.getAttr(node, key) comp = component[name] self.assertEqual(eval('comp.%s' % key), name)
def test_all(self): try: if self.path[:7] == 'http://': self.wsdl = WSDLReader().loadFromURL(self.path) else: self.wsdl = WSDLReader().loadFromFile(self.path) except TimeoutError: print("connection timed out") sys.stdout.flush() return except: self.path = self.path + ": load failed, unable to start" raise try: self.checkWSDLCollection('service', self.wsdl.services) except: self.path = self.path + ": wsdl.services" raise try: self.checkWSDLCollection('message', self.wsdl.messages) except: self.path = self.path + ": wsdl.messages" raise try: self.checkWSDLCollection('portType', self.wsdl.portTypes) except: self.path = self.path + ": wsdl.portTypes" raise try: self.checkWSDLCollection('binding', self.wsdl.bindings) except: self.path = self.path + ": wsdl.bindings" raise try: self.checkWSDLCollection('import', self.wsdl.imports, key='namespace') except: self.path = self.path + ": wsdl.imports" raise try: for key in list(self.wsdl.types.keys()): schema = self.wsdl.types[key] self.assertEqual(key, schema.getTargetNamespace()) definition = self.wsdl.document.documentElement version = DOM.WSDLUriToVersion(definition.namespaceURI) nspname = DOM.GetWSDLUri(version) for node in DOM.getElements(definition, 'types', nspname): for snode in DOM.getElements(node, 'schema'): tns = DOM.findTargetNS(snode) schema = self.wsdl.types[tns] self.schemaAttributesDeclarations(schema, snode) self.schemaAttributeGroupDeclarations(schema, snode) self.schemaElementDeclarations(schema, snode) self.schemaTypeDefinitions(schema, snode) except: self.path = self.path + ": wsdl.types" raise if self.wsdl.extensions: print('No check for WSDLTools(%s) Extensions:' % (self.wsdl.name)) for ext in self.wsdl.extensions: print('\t', ext)