2

Currently I am calling an external webservice from command line in Unix :

curl --cert externalcertificate.cer --data @SampleRequest.xml -v https://world-service-dev.intra.a.com:4414/worldservice/CLIC/CaseManagementService/V1

I need to integrate this call in my python code . Then I will put retry logic and response validation around it , what is the optimal way of making this call ? Since its a one way SSL , I also need to make sure my web service call refers to the external server certificate kept on my server as well .

I could not use requests module of Python as it is not installed on the server, I tried using urllib2 but facing multiple issue related to ssl as it is a https call . Now I am trying to call a sub process module : subprocess.call(['curl', '-k', '-H' , 'content-type: application/soap+xml' ,'-d', etree.tostring(tree), '-v' ,'"https://world-service-dev.intra.aexp.com:4414/worldservice/CLIC/CaseManagementService/V1"'])

But getting an error message :

* Protocol "https not supported or disabled in libcurl curl: (1) Protocol "https not supported or disabled in libcurl

Ishu Gupta
  • 1,071
  • 1
  • 19
  • 43

2 Answers2

1

I would use Requests to call that web service.

Clicquot the Dog
  • 530
  • 2
  • 6
  • 19
  • I think I can use r = requests.post(url, files=files) but how do I handle the certificate part... how do I make sure I also pass the server certificate while making this call. – Ishu Gupta Feb 23 '15 at 20:38
  • Sadly I do not have requests library installed on my python environment and I do not have permissions to install it as well since its QA environment . Is there any other module I can use ? – Ishu Gupta Feb 23 '15 at 20:51
  • 1
    Have at look at the answers here, specifically this one http://stackoverflow.com/a/2667545/3236133 – Clicquot the Dog Feb 23 '15 at 21:01
0

I had a an extra double quote in front of my URL that was causing this problem to happen , Here is the correct syntax 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'])

Ishu Gupta
  • 1,071
  • 1
  • 19
  • 43