WSDL parsing problem

N

Nick Caldwell

Y'all,

Problem: Reading complex data types returned from WSDL

I'll present this in 3 sections.

1. Output of WSDL parser on Google API
2. Output of WSDL parser on Custom API
3. WSDL parser code

1. Output of WSDL parser on Google API
So far I have a very simple WSDL reader which gathers the commnads and
arguments of the WSDL. For instance, running against the google API
generates:
Commands: [u'doGoogleSearch', u'doGetCachedPage',
u'doSpellingSuggestion']

Arguments for "doGoogleSearch":
key (u'http://www.w3.org/2001/XMLSchema', u'string')
q (u'http://www.w3.org/2001/XMLSchema', u'string')
start (u'http://www.w3.org/2001/XMLSchema', u'int')
maxResults (u'http://www.w3.org/2001/XMLSchema', u'int')
filter (u'http://www.w3.org/2001/XMLSchema', u'boolean')
restrict (u'http://www.w3.org/2001/XMLSchema', u'string')
safeSearch (u'http://www.w3.org/2001/XMLSchema', u'boolean')
lr (u'http://www.w3.org/2001/XMLSchema', u'string')
ie (u'http://www.w3.org/2001/XMLSchema', u'string')
oe (u'http://www.w3.org/2001/XMLSchema', u'string')

With this it is easy to create a command and send it the proper value
types. You still have to know what each does, but the type is
obvious.


2. Output of WSDL parser on Custom API
When I run this against my company's custom API, though, I see the
comnmands fine:

Commands: [u'getCustomerInformation']

But the argument names and types look like:
getCustomerInformationRequest
(u'java:com.productname.productversion.soap', u'ge
tCustomerInformation')

Now, according to my developers this is because they treat each api
call like a separate document which returns several values, whereas
the google API treats each as a separate data type (string).

The WSDL would look like this:
<xsd:complexType name="CustomerInfo">
<xsd:sequence>
<xsd:element type="xsd:string" name="email" minOccurs="1"
maxOccurs="1" nillable="true" />
<xsd:element type="xsd:string" name="firstName" minOccurs="1"
maxOccurs="1" nillable="true" />
<xsd:element type="xsd:string" name="lastName" minOccurs="1"
<xsd:element type="xsd:string" name="phoneNumber" minOccurs="1"
maxOccurs="1" nillable="true" />
</xsd:sequence>
</xsd:complexType>

Can I somehow parse the response from the WSDL to get at the atomic
data types? The goal is to do this programmatically to provide a GUI
front end for the APIs for testing.

3. WSDL reader
#!/usr/bin/env python
#http level debugging
import httplib
httplib.HTTPConnection.debuglevel = 1

from SOAPpy import WSDL
server = WSDL.Proxy('d:/googleapi/GoogleSearch.wsdl')
print server.methods.keys()
callInfo = server.methods['doGoogleSearch']
for arg in callInfo.inparams:
print arg.name.ljust(15), arg.type

Any help at all would be appreciated.

Sincerely,

Nick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,218
Messages
2,571,124
Members
47,727
Latest member
smavolo

Latest Threads

Top