Search code examples
androidweb-servicessoapksoap2ksoap

Calling web-service using WSE on Android


I've been using the ksoap2 library for all of my SOAP calls and they have all been successful. But when I try to call a web-service that uses WSE I receive the following error...

Code: soap:Sender, Reason: WSE012: The input was not a valid SOAP message because the following information is missing: action.

From what I can tell, this means that the soap action is required in the header, but it clearly states in the documentation that SOAPAction is not a valid header for version 12. http://code.google.com/p/ksoap2-android/issues/detail?id=67

When I do add it as header I simply receive a "server was unable to process request" error. I've been stuck on this for a while and was hoping someone knows what's up. Here is the main code...

SoapObject request = new SoapObject(namespace, methodName);
request.addProperty(name, value);    
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER12);
envelope.dotNet = true;  
envelope.setOutputSoapObject(request);
try {
    HttpTransportSE transport = new HttpTransportSE(URL);
    List<HeaderProperty> headers = new ArrayList<HeaderProperty>();
    headers.add(new HeaderProperty("SOAPAction", soapAction));
    transport.call(soapAction, envelope, headers);
} catch (Exception e) {
    e.printStackTrace();
}

Solution

  • It looks like the ksoap library excludes the soap action from the envelope on Soap VER12. This action is needed for WSE enhanced web services, so a simple change from VER12 to VER11 does the trick.