如何在android中将参数值传递给webservice
发布于 2010-11-04 16:18:21
webservice请求仍然是一个基本的POST方法,有些方法接受GET。
打开WSDL (如果它是MS服务,例如以.asmx结尾),这将显示请求包的示例……
http://www.w3schools.com/webservices/tempconvert.asmx?op=CelsiusToFahrenheit
====================================
HTTP POST
The following is a sample HTTP POST request and response. The placeholders shown need to be replaced with actual values.
POST /webservices/tempconvert.asmx/CelsiusToFahrenheit HTTP/1.1
Host: www.w3schools.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
Celsius=string
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/">string</string>=================================
HEADER POST /webservices/tempconvert.asmx/CelsiusToFahrenheit HTTP/1.1主机: www.w3schools.com内容类型:应用程序/x-www-form-form编码内容-长度:长度
正文字符串
因此主体是"string=32“
HttpClient会做的。
请参阅:- Android, sending XML via HTTP POST (SOAP)
你也可以尝试KSOAP,但是你可以!走上痛苦的世界,我从来没有真正和它交过朋友……
发布于 2010-11-04 16:21:44
另一种方法是构造整个soap包并发布该包。我更喜欢这种方式,就好像提供者去掉了POST动词一样,你还是可以的。
因此,构建soap包(来自上面链接中的asmx示例)并发布它。
Fiddler也会在这方面帮到你。
https://stackoverflow.com/questions/4094298
复制相似问题