python - TypeError in SOAP Request (using pysimplesoap) -


i'm trying relevant information soap service dutch government land register (wsdl here) pysimplesoap. far managed connect , request information specific property following code:

from pysimplesoap.client import soapclient client = soapclient(wsdl='http://www1.kadaster.nl/1/schemas/kik-inzage/20141101/verzoektotinformatie-2.1.wsdl', username='xxx', password='xxx', trace=true)  response = client.verzoektotinformatie(     aanvraag={         'berichtversie': '4.7',  # refers schema version         'klantreferentie': klantreferentie,  # reference can set ourselves.         'productaanduiding': '1185',  # four-digit code referring whether response should in "xml" (1185), "pdf" (1191) or "xml , pdf" (1057).         'ingang': {             'object': {                 'imkad_kadastraleaanduiding': {                     'gemeente': 'arnhem ac',  # municipality                     'sectie': 'ac',  # section code                     'perceelnummer': '1234'  # lot number                 }             }         }     } ) 

this "kinda" works. set trace=true extensive log messages, , in log messages see humongous xml output (paste here) pretty includes info request. but, traceback:

traceback (most recent call last):   file "<input>", line 1, in <module>     'perceelnummer': perceelnummer   file "/library/python/2.7/site-packages/pysimplesoap/client.py", line 181, in <lambda>     return lambda *args, **kwargs: self.wsdl_call(attr, *args, **kwargs)   file "/library/python/2.7/site-packages/pysimplesoap/client.py", line 346, in wsdl_call     return self.wsdl_call_with_args(method, args, kwargs)   file "/library/python/2.7/site-packages/pysimplesoap/client.py", line 372, in wsdl_call_with_args     resp = response('body', ns=soap_uri).children().unmarshall(output)   file "/library/python/2.7/site-packages/pysimplesoap/simplexml.py", line 433, in unmarshall     value = children , children.unmarshall(fn, strict)   file "/library/python/2.7/site-packages/pysimplesoap/simplexml.py", line 433, in unmarshall     value = children , children.unmarshall(fn, strict)   file "/library/python/2.7/site-packages/pysimplesoap/simplexml.py", line 433, in unmarshall     value = children , children.unmarshall(fn, strict)   file "/library/python/2.7/site-packages/pysimplesoap/simplexml.py", line 380, in unmarshall     raise typeerror("tag: %s invalid (type not found)" % (name,)) typeerror: tag: imkad_perceel invalid (type not found) 

as far understand, means imkad_perceel tag cannot understood simplexml parser (i'm guessing) because not read/find definition of tag in wdsl file.

so checked (enormous amount of) log messages parsing wsdl file, , shows these lines:

debug:pysimplesoap.helpers:parsing element element: imkad_perceel debug:pysimplesoap.helpers:processing element imkad_perceel element debug:pysimplesoap.helpers:imkad_perceel has no children! debug:pysimplesoap.helpers:complexcontent/simpletype/element imkad_perceel = imkad_perceel debug:pysimplesoap.helpers:parsing element complextype: imkad_perceel debug:pysimplesoap.helpers:processing element imkad_perceel complextype debug:pysimplesoap.helpers:complexcontent/simpletype/element imkad_perceel = imkad_onroerendezaak debug:pysimplesoap.helpers:processing element imkad_perceel complextype 

i guess these lines mean imkad_perceel definition empty. used soapui introspect the wsdl file, in found an url .xsd-file in find definition of imkad_perceel:

<xs:element name="imkad_perceel"      substitutiongroup="ipkbo:imkad_onroerendezaak"      type="ipkbo:imkad_perceel"     /> 

the tag indeed seems closing itself, means empty. reason pysimplesoap thinks imkad_perceel not defined? why can't interpret xml , return dict? (as said before, full xml output receive in this paste).

does know how can make pysimplesoap interpret xml , convert dict, regardless whether adheres wsdl?

all tips welcome!

it seems pysimplesoap not capable of dealing substitutiongroup in xml schema.

you can see in xsd file:

<xs:element name="imkad_perceel"  substitutiongroup="ipkbo:imkad_onroerendezaak"  type="ipkbo:imkad_perceel" /> 

there substitutiongroup, means imkad_perceel , imkad_onroerendezaak same thing , substitutable each other.

in soap schema, particular part of response defined as:

<xs:complextype name="berichtgegevens">  <xs:annotation>    <xs:documentation>inhoud van het bericht.</xs:documentation>      </xs:annotation>  <xs:sequence>    <xs:element ref="ipkbo:imkad_onroerendezaak" minoccurs="1" maxoccurs="1"/>    <xs:element ref="ipkbo:recht" minoccurs="1" maxoccurs="1"/><xs:element ref="ipkbo:imkad_stuk" minoccurs="0" maxoccurs="unbounded"/>    <xs:element ref="ipkbo:imkad_persoon" minoccurs="1" maxoccurs="unbounded"/>    <xs:element ref="ipkbo:gemeentelijkeregistratie" minoccurs="0" maxoccurs="unbounded"/>  </xs:sequence> </xs:complextype> 

however, can see actual response like:

<ipkbo:berichtgegevens>   <ipkbo:imkad_perceel>...</ipkbo:imkad_perceel>   <ipkbo:recht>...</ipkbo:recht>   <ipkbo:imkad_aangebodenstuk>...</ipkbo:imkad_aangebodenstuk>   <ipkbo:imkad_persoon>...</ipkbo:imkad_persoon> </ipkbo:berichtgegevens> 

then pysimplesoap seems confused , fail correct type of response.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -