Assume this as a sample SOAP 1.1 Message
SOAP 1.1
The following is a sample SOAP 1.1 request and response. The placeholders shown need to be replaced with actual values.
POST /Service.asmx HTTP/1.1
Host: 64.49.254.143
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/isValidUser"
><?xml version="1.0" encoding="utf-8"?>
<soap:Body>
<isValidUser xmlns="http://tempuri.org/">
<Username>string</Username>
<Password>string</Password>
</isValidUser>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?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>
<isValidUserResponse xmlns="http://tempuri.org/">
<isValidUserResult>boolean</isValidUserResult>
</isValidUserResponse>
</soap:Body>
</soap:Envelope>
------------ Sample Code for Connect to the web service (URL: http://192.21.0.32/Service.asmx) -----------
SoapObject request = new SoapObject("http://tempuri.org/","isValidUser");
request.addProperty("Username","BB");
request.addProperty("Password","BB123");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.bodyOut = request;
envelope.dotNet = true;
HttpTransport ht = new HttpTransport("http://64.49.254.143:8080/Service.asmx");
ht.debug = true;
try {
ht.call("http://tempuri.org/isValidUser", envelope);
Dialog.alert("response"+envelope.getResponse().toString());
}
catch (XmlPullParserException ex)
{
Dialog.alert("ex1 "+ex.toString() );
ex.printStackTrace();
} catch (IOException ex) {
Dialog.alert("ex2 " +ex.toString());
ex.printStackTrace();
} catch (Exception ex) {
Dialog.alert("ex3 " + ex.toString());
}
Refere : http://www.blackberryforums.com/developer-forum/155972-blackberry-ksoap2-tutorial.html
Comments