目前,我正在从Unix中的命令行调用外部Web服务:
curl --cert externalcertificate.cer --data @SampleRequest.xml -v https://world-service-dev.intra.a.com:4414/worldservice/CLIC/CaseManagementService/V1
我需要在python代码中集成这个调用。然后,我将围绕它放置重试逻辑和响应验证,进行此调用的最佳方式是什么?因为它是单向SSL,所以我还需要确保我的web服务调用也引用了保存在服务器上的外部服务器证书。在
我不能使用Python的requests模块,因为它没有安装在服务器上,我尝试使用urllib2,但由于ssl是一个https调用,因此面临多个问题。
现在我尝试调用一个子流程模块:
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"'])
但得到一条错误消息:
* Protocol "https not supported or disabled in libcurl
curl: (1) Protocol "https not supported or disabled in libcurl
我将使用Requests调用该web服务。在
我的URL前面有一个额外的双引号,这是导致这个问题发生的原因,这里是正确的语法
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'])
相关问题 更多 >
编程相关推荐