I am callign a webservice from my Python code :
response = subprocess.call(['curl', '-k', '-i', '-H' , 'content-type: application/soap+xml' ,'-d', etree.tostring(tree), '-v' ,'https://world-service-dev.intra.aexp.com:4414/worldservice/CLIC/CaseManagementService/V1'])
The service returns a soap message , how do I parse the soap message and find out if it was a failure or success?
I tried to use the following but I am getting wrong results :
subprocess.check_output("curl -k --data "+etree.tostring(tree)+"@SampleRequest.xml -v https://world-service-dev.intra.aexp.com:4414/worldservice/CLIC/CaseManagementService/V1",stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
Don't PIPE
just call check_output
passing a list of args and remove shell=True
:
out = subprocess.check_output(["curl", "-k","--data", etree.tostring(tree)+"@SampleRequest.xml", "-v", "https://world-service-dev.intra.aexp.com:4414/worldservice/CLIC/CaseManagementService/V1"])
If you get a non-zero exit code you will get a CalledProcessError
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With