user7485012
user7485012

Reputation: 1

SOAP request using Zeep (Python) "raise XMLParseError: Unexpected element "

ZEEP version 3.4.0 Python 3.7.7

I'm receiving a strange " raise XMLParseError("Unexpected element %r" % elements[0].tag)" in complex.py line 204 when I simply change from "N" to "Y" for 'repsAndCerts below:

client = Client('https://gw.sam.gov/SAMWS/1.0/Entity?wsdl', transport = transport, plugins=[history])

userid = XXXXXXXX
pswd = YYYYYYYYY
DUNSNO = ZZZZZZZ

client.service.getEntities(
authenticationKey = {'userID': userid,
'password': pswd },
entitySearchCriteria = {
'DUNSNumber': DUNSNO,
},
requestedData = {'coreData': 'Y', 'repsAndCerts': 'Y'}
)

script below:

session = Session()
history = HistoryPlugin()
transport = Transport(session=session)
client = Client('https://gw.sam.gov/SAMWS/1.0/Entity?wsdl', transport = transport, plugins=[history])

userid = XXXXXXX
pswd = YYYYYYY
DUNSNO = ZZZZZZZ

client.service.getEntities(
authenticationKey = {'userID': userid,
'password': pswd },
entitySearchCriteria = {
'DUNSNumber': DUNSNO,
},
requestedData = {'coreData': 'Y', 'repsAndCerts': 'Y'}
)

output:

File "/Users/thermalneutron/opt/anaconda3/lib/python3.7/site-packages/zeep/xsd/types/complex.py", line 204, in parse_xmlelement raise XMLParseError("Unexpected element %r" % elements[0].tag)

XMLParseError: Unexpected element 'businessObject'

anyone familiar with this?

Upvotes: 0

Views: 1284

Answers (1)

I had this error, was just use strict=false when calling a operation like this:

client = getClient(wsdl_path)
...

with client.settings(strict=False):
    resp = client.service.Operation(...)

You can try to create with the settings Client(wsdl_path,strict=False,...), for me don't work, all your settings can be in this with.

Upvotes: 1

Related Questions