简体   繁体   中英

Locally save and parse suds response?

I am new to SOAP and suds. I am calling a non-XML SOAP API using suds. A given result contains a ton of different sub-arrays. I thought I would just locally save the whole response for parsing later but easier said than done. And I don't get this business with the built in cache option where you cache for x days or whatever. Can I permanently save and parse a response locally?

You can write the response to a local file:

client = Client("http://someWsdl?wsdl")

# Getting response object
method_response = client.service.someMethod(methodParams)

# Open local file
fd = os.open("response_file.txt",os.O_RDWR|os.O_CREAT)

# Convert response object into string
response_str = str(method_response)

# Write response to the file
ret = os.write(fd,response_str)

# Close the file
os.close(fd)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM