发送 SOAP 请求
在我的应用程序中,我想向某个 url 发送 SOAP 请求,要发送的 SOAP 请求如下
POST /TelLink/WrenchENTService.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://WrenchGlobal/GetToDoList"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetToDoList xmlns="http://WrenchGlobal/">
<viPeriod>int</viPeriod>
<vsUserID>string</vsUserID>
</GetToDoList>
</soap:Body>
</soap:Envelope>
在上面的代码中,我必须将“int”和“string”替换为实际值,它将调用 GetToDoList服务器。我的问题是,我不知道如何将这个请求发送到服务器? (使用httppost)有人可以帮助我吗?
In my application I want to send a SOAP request to some url, the SOAP request to be sent is as below
POST /TelLink/WrenchENTService.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://WrenchGlobal/GetToDoList"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetToDoList xmlns="http://WrenchGlobal/">
<viPeriod>int</viPeriod>
<vsUserID>string</vsUserID>
</GetToDoList>
</soap:Body>
</soap:Envelope>
In the above code, I will have to replace "int" and "string" with actual values and it will invoke GetToDoList on the server. My problem is, I dont know how to send this request to the server? (using httppost) Could anyone help me out?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
希望这会有所帮助。
Hope this would help.
IntentService HttpPost 可能是您想要的。谷歌上有很多可用的片段; 这里只是其中之一。
IntentService HttpPost are probably what you want. There are plenty of snippets available on Google; here's just one of them.