Given the wsdl may not contain a <schema/> element, the get_schema() is changed to ensure that at least one (default) schema is contained in the returned collection
This commit is contained in:
parent
34f7663df1
commit
7c9e942064
13
suds/sax.py
13
suds/sax.py
|
@ -111,6 +111,19 @@ class Element:
|
|||
'endswith' : lambda a,b: a.endswith(b),
|
||||
'contains' : lambda a,b: b in a
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def buildPath(self, parent, path):
|
||||
"""
|
||||
build the specifed path as a/b/c where missing intermediate nodes are built
|
||||
automatically
|
||||
"""
|
||||
for tag in path.split('/'):
|
||||
child = parent.getChild(tag)
|
||||
if child is None:
|
||||
child = Element(tag, parent)
|
||||
parent = child
|
||||
return child
|
||||
|
||||
def __init__(self, name, parent=None, ns=None):
|
||||
self.prefix, self.name = splitPrefix(name)
|
||||
|
|
10
suds/wsdl.py
10
suds/wsdl.py
|
@ -101,10 +101,14 @@ class WSDL:
|
|||
def get_schema(self):
|
||||
""" get a collective schema of all <schema/> nodes """
|
||||
container = SchemaCollection(self)
|
||||
for sr in self.root.childrenAtPath('types/schema'):
|
||||
schema = Schema(sr, self.url, container)
|
||||
for root in self.root.childrenAtPath('types/schema'):
|
||||
schema = Schema(root, self.url, container)
|
||||
container.append(schema)
|
||||
self.log.debug('schema (container):\n', container)
|
||||
if not len(container): # empty
|
||||
root = Element.buildPath(self.root, 'types/schema')
|
||||
schema = Schema(root, self.url, container)
|
||||
container.append(schema)
|
||||
self.log.debug('schema (container):\n%s', container)
|
||||
return container
|
||||
|
||||
def get_servicename(self):
|
||||
|
|
|
@ -47,10 +47,10 @@ class Test:
|
|||
|
||||
def test_misc(self):
|
||||
|
||||
service = ServiceProxy('https://sec.neurofuzz-software.com/paos/genSSHA-SOAP.php?wsdl',
|
||||
faults=True,
|
||||
nil_supported=False,
|
||||
proxy={'http':'10.1.1.1'})
|
||||
service = ServiceProxy('http://soa.ebrev.info/service.wsdl')
|
||||
print service
|
||||
|
||||
service = ServiceProxy('https://sec.neurofuzz-software.com/paos/genSSHA-SOAP.php?wsdl')
|
||||
print service
|
||||
print service.genSSHA('hello', 'sha1')
|
||||
|
||||
|
|
Loading…
Reference in New Issue