Python SUDS return type other than XML
Asked Answered
P

1

6

I am working with a somewhat non-standard SOAP webservice. Most of the calls to the webservice return the standard SOAP XML as you would expect, but one call in particular returns a JSON string instead. This fouls up the xml parser on the client side.

My question is; is there a way to designate the return type on a particular webmethod in SUDS so that it does not try to run it through the xml parser? I just want the raw JSON response.

Philipphilipa answered 11/10, 2011 at 22:16 Comment(1)
The return type is designated within the WSDL. Any way you can provide visual examples of what you're experiencing?Demakis
A
1

I would use the Python JSON encoder to validate first if it is JSON before feeding it to the XML parser.

try:
    json.loads(json_to_test)
except ValueError:
    print "Invalid json"
Aptitude answered 28/10, 2011 at 13:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.