I am new to WSDL webservices , using KSoap2 library to call wsdl webservices in android .
This is my soap request dump
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; xmlns:loy="http://loyalcard.com/LoyalCardWebService/">;
<soapenv:Header/>
<soapenv:Body>
<loy:GetOffersByLocation>
<!--Optional:-->
<loy:Location>
<!--Optional:-->
<loy:Latitude>?</loy:Latitude>
<!--Optional:-->
<loy:Longitude>?</loy:Longitude>
</loy:Location>
</loy:GetOffersByLocation>
</soapenv:Body>
</soapenv:Envelope>
I am passing this SopaObject like :
PropertyInfo latitude = new PropertyInfo();
latitude.name="Latitude";
latitude.type=Double.class;
latitude.setValue(32.806673);
PropertyInfo longitude = new PropertyInfo();
longitude.name="Longitude";
longitude.type=Double.class;
longitude.setValue(-86.791133);
SoapObject results = null;
String methodName = "OffersByLocation";
String actionName = "http://loyalcard.com/LoyalCardWebService/GetOffersByLocation";
SoapObject request = new SoapObject(NAMESPACE,methodName);
request.addProperty(latitude);
request.addProperty(longitude);
Here am passing latitude and longitude values directly to OffersByLocation , I should pass through element Location . Please can any one help how to pass parameters through Location .
I have tried with above procedure but am getting error saying
06-17 11:52:55.934: WARN/System.err(350): SoapFault - faultcode: 'soapenv:Server' faultstring: 'org.apache.axis2.databinding.ADBException: Unexpected subelement Latitude' faultactor: 'null' detail: org.kxml2.kdom.Node@44f6ddc0
Please can any one tell me how to pass above soap Request dump in Soap Object ?
Regards, Srinivas
You can also manually construct the request XML, and send it to kSOAP for sending and response processing. You can write your request XML using soapUI, then save them in
res/raw
with keywords like{%key%}
where parameters should be placed at runtime. Here is the code for replacing the keywords:To send custom XML request with kSOAP you need to make your own Transport class.
Or you can send the request manually using
DefaultHttpClient
(see Using client/server certificates for two way authentication SSL socket on Android), and use kSOAP just for parsing the response.You have to make your own xml generator class to do that. I am also using the same procedure. decompile the ksoap2 library and study the how they generate and change it as you required..
You can use like this.
I hope this may help u
Thanks, Chaitanya