kartagis / pysimplesoap

Automatically exported from code.google.com/p/pysimplesoap
0 stars 0 forks source link

Response object name issue #76

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
property in service method return value 

queryMeta() --> return { 'params': { ... }}

wsdl gives the name ArrayOfqueryMetaResponseparams

is there any way to to convert it

ArrayOfQueryMetaResponseParams

Original issue reported on code.google.com by greatghoul on 6 Aug 2012 at 8:54

GoogleCodeExporter commented 8 years ago
I have exactly the same problem (although with another WSDL service), any 
progress/solutions/workarounds for this issue?

Original comment by tomasz.w...@gmail.com on 8 Oct 2013 at 12:01

GoogleCodeExporter commented 8 years ago
Can you provide/attach a sample wsdl to test it?

Some WSDL are complex or require som extra parameters to be parsed correctly.

Also, please try to test the latest changes from the repository:

http://code.google.com/p/pysimplesoap/source/checkout

or donwload them in a zip form:

http://code.google.com/p/pysimplesoap/source/browse/

Original comment by reingart@gmail.com on 8 Oct 2013 at 4:16

GoogleCodeExporter commented 8 years ago
The WSDL I connect to returns two kind of results - single objects or arrays of 
objects. Everything works well with single objects, but I'm getting errors 
while calling functions returning arrays.

I attach producer_docs.xml which contains documentation of "producer" endpoint. 
I try to invoke "GetProducerList" function, which returns an array of producer 
objects. You can find its result sample in another attached file - test2.xml.

When using version 1.10 I was getting folowwing excepton:

Traceback (most recent call last):
  File "main.py", line 174, in <module>
    client.request('GetProducerList', limit=10, offset=0)
  File "/home/tomasz/Dev/smille/src/sote/__init__.py", line 54, in request
    response = function(**kwargs)[response_key]
  File "/home/tomasz/Dev/smille/local/lib/python2.7/site-packages/pysimplesoap/client.py", line 141, in <lambda>
    return lambda *args, **kwargs: self.wsdl_call(attr, *args, **kwargs)
  File "/home/tomasz/Dev/smille/local/lib/python2.7/site-packages/pysimplesoap/client.py", line 287, in wsdl_call
    resp = response('Body', ns=soap_uri).children().unmarshall(output)
  File "/home/tomasz/Dev/smille/local/lib/python2.7/site-packages/pysimplesoap/simplexml.py", line 523, in unmarshall
    value = children and children.unmarshall(fn, strict)
  File "/home/tomasz/Dev/smille/local/lib/python2.7/site-packages/pysimplesoap/simplexml.py", line 523, in unmarshall
    value = children and children.unmarshall(fn, strict)
  File "/home/tomasz/Dev/smille/local/lib/python2.7/site-packages/pysimplesoap/simplexml.py", line 473, in unmarshall
    fn = REVERSE_TYPE_MAP[xsd_type]
KeyError: u'GetProducerListResponse'

When using latest version from links that you provided, everything works a lot 
better - I get a list of XMLs in response:

{'GetProducerListResponse': [<item 
xsi:type="ns1:GetProducerListResponse"><created_at 
xsi:type="xsd:dateTime">2012-08-17T01:16:58+02:00</created_at><updated_at 
xsi:type="xsd:dateTime">2012-08-17T01:16:58+02:00</updated_at><id 
xsi:type="xsd:integer">5</id><name xsi:type="xsd:string">AVON</name><url 
xsi:type="xsd:string">avon</url></item>,
                             <item xsi:type="ns1:GetProducerListResponse"><created_at xsi:type="xsd:dateTime">2012-08-17T01:16:40+02:00</created_at><updated_at xsi:type="xsd:dateTime">2012-08-17T01:16:40+02:00</updated_at><id xsi:type="xsd:integer">3</id><name xsi:type="xsd:string">IKEA</name><url xsi:type="xsd:string">ikea</url></item>,
                             <item xsi:type="ns1:GetProducerListResponse"><created_at xsi:type="xsd:dateTime">2012-08-17T01:16:50+02:00</created_at><updated_at xsi:type="xsd:dateTime">2012-08-17T01:16:50+02:00</updated_at><id xsi:type="xsd:integer">4</id><name xsi:type="xsd:string">Oriflame</name><url xsi:type="xsd:string">oriflame</url></item>]}

That's pretty close, I could now parse it with lxml, but I'd be a lot happier 
if you could fix it or just give some tips how to convert it to Python types (I 
guess that it should be done using unmarshall() method, but I haven't had 
enough time to go through it yet.)

Anyways thanks for your great work -- the WSDL I'm connecting to is kinda 
screwed, but I have the fewest problems when using pysimplesoap :-)

Original comment by tomasz.w...@gmail.com on 8 Oct 2013 at 6:38

Attachments: