passing parameter
How to pass parameter v开发者_开发问答alue to webservice in android
A webservice request is still a basic POST method, and some accept GET.
Open the WSDL (if its a MS service, e.g. ends with .asmx) and this will show examples of the request packet...
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 Host: www.w3schools.com Content-Type: application/x-www-form-urlencoded Content-Length: length
BODY string
Therefore the body is "string=32"
HttpClient will do...
Also see : - Android, sending XML via HTTP POST (SOAP)
You could also try KSOAP, however you !could! be embarking on a world of pain, I never really made friends with it....
Another way is to construct the entire soap packet and post that. I prefer that way, as if the provider removes the POST verb, your still ok.
So builder the soap packet (from the asmx example in the link above) and post that.
Fiddler will also help you here.
精彩评论