soap HTTP 调用
2014-05-05 10:05
274 查看
1、通过soapui 查看调用的代码
</pre><pre code_snippet_id="371258" snippet_file_name="blog_20140531_3_2326006" name="code" class="python">
2、调用的python代码
def call_soap_with_http(url,send_msg): import httplib import urllib import urlparse url_info = urlparse.urlparse(url) host,port = url_info.netloc.split(":") path = url_info.path conn = httplib.HTTPConnection(host,port) headers = {"Content-Type":"text/xml; charset=utf-8", "Content-Length":"%d" % len(send_msg), "SOAPAction":"\"\""} conn.request("POST", path, '', headers) conn.send(send_msg) ret = conn.getresponse().read() return ret
3、调用类似如下:
url="http://xxx.xxx.xxx.xxx/services/test_services" msg = u""" <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ui="http://ui.server.pointquery.vas.soap.interfaces.lcsmp.linkage.com" xmlns:req="http://req.ui.server.tst.vas.soap.interfaces.lcsmp.linkage.com"> <soapenv:Header/> <soapenv:Body> <ui:test> <ui:req> <req:arg1>?</req:arg1> </ui:req> </ui:test> </soapenv:Body> </soapenv:Envelope> """ result = call_soap_with_http(url,msg) print result
相关文章推荐
- 使用URL工具类调用webservice接口(soap)与http接口的实现方式
- Java调用.net的webService产生“服务器未能识别 HTTP 标头 SOAPAction 的值”错误
- Axis2 调用.net webservice 出现 服务器未能识别 HTTP 头 SOAPAction 的值错误 的解决办法
- java网络编程(3):HTTP协议调用SOAP
- 解决:Java调用.net的webService产生“服务器未能识别 HTTP 标头 SOAPAction 的值”错误
- Java调用.Net WebService 发生异常:服务器未能识别 HTTP 头 SOAPAction 的值
- C# 利用Http Get,Post,Soap调用WebService
- python通过http请求发送soap报文进行webservice接口调用
- HttpURLConnection 直接发送soap消息调用webservice
- SoapHttpClientProtocol,调用制定服务的指定方法
- cxf 调用 .net webservice 出现服务器未能识别 HTTP 标头 SOAPAction 的值 解决方案
- HttpURLConnection 直接发送soap消息调用webservice
- HttpURLConnection 直接发送soap消息调用webservice
- Delphi 客户端调用Webservice 的TClientdataset 报出“http://www.borland.com/namespaces/Types-IAppServerSOAP”
- Java调用.Net写的WebService报异常:服务器未能识别 HTTP 头 SOAPAction 的值
- C#通过构造Soap信息使用HttpWebRequest调用WebService
- 如何在 SOAP 接口调用的 Http header 中增加字段
- HttpURLConnection 直接发送soap消息调用webservice
- php调用java写的webservices提示Uncaught SoapFault exception: [HTTP] Not Found
- http 调用soap webservice