I am using ksoap2 for communicating with a remote web service. For some reason, the properties I add to soapObject are not being sent. Where have I gotten wrong? I have tried everything, I get a response when I perform direct posting of the request xml but that is not what I want. I also get a response from the server but none of the values I post are being passed. I have read every blog out there, the official documentation and even related SO questions, What have I missed?
Here is a snippet of a method being called from the doInBackground() of Async Task.
public SoapObject getSoapObject() {
// Create request
SoapObject requesty = new SoapObject(NAMESPACE, METHOD_NAME);
// Add the property to request object
requesty.addProperty(getPropertyInfo("PARAMETER_1", "VALUE_1"));
// Create envelope
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
// Set output SOAP object
envelope.setOutputSoapObject(requesty);
// Create HTTP call object
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
SoapObject soapObject = null;
try {
// Send to web service
androidHttpTransport.call(SOAP_ACTION, envelope);
soapObject = (SoapObject) envelope.getResponse();
} catch (SoapFault e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (HttpResponseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (XmlPullParserException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return soapObject;
}
private PropertyInfo getPropertyInfo(String name, String value) {
PropertyInfo propInfo = new PropertyInfo();
propInfo.setName(name);
propInfo.setValue(value);
propInfo.setType(string.class);
return propInfo;
}
Instead of using ksoap2, I posted directly via HttpPost and manually parsed the different values with a custom XML parser. I know this might not be the best of the choices but SOAP is just old school now.