Non-XML Python SUDS Return Type

I work with a somewhat non-standard SOAP web service. Most web service calls return standard SOAP XML, as you would expect, but one call, in particular, returns a JSON string. This hides the client-side XML parser.

My question is: is there a way to specify the return type on a specific web method in SUDS so that it does not try to run it through the xml parser? I just need a raw JSON response.

+6
source share
1 answer

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

try: json.loads(json_to_test) except ValueError: print "Invalid json" 
+1
source

Source: https://habr.com/ru/post/899082/


All Articles