0

When I am using SoapUI to call this web service I am getting the correct response but when I implement this in android, I am getting the below exception,

system.web.services.protocols.soapheaderexception (some information is missing).

This is what I tried,

       HttpPost httppost = new HttpPost("http://www.ocrwebservice.com/services/OCRWebService.asmx");
       StringEntity se = new StringEntity(SOAPRequestXML,HTTP.UTF_8);
       se.setContentType("text/xml");
       httppost.setHeader("Content-Type", "text/xml;charset=UTF-8");
       httppost.setEntity(se);
       HttpClient httpclient = new DefaultHttpClient();
       BasicHttpResponse httpResponse = 
        (BasicHttpResponse) httpclient.execute(httppost);
    HttpEntity resEntity = httpResponse.getEntity();

I tried other combinations also like, httppost.setHeader("Accept-Charset","utf-8") and httppost.setHeader("Content-Type","application/soap+xml;charset=UTF-8")

But nothing worked.

The error says,

System.Web.Services.Protocols.SoapHeaderException: WSE012: The input was not a valid SOAP message because the following information is missing: action.

4
  • Can you please add stacktace ? Commented Jun 1, 2013 at 14:49
  • Can you share the wsdl? Commented Jun 1, 2013 at 14:50
  • ocrwebservice.com/services/OCRWebService.asmx this is the wsdl Commented Jun 1, 2013 at 14:50
  • @ Paresh Looking at the service, How can I set action, can you help in that. Commented Jun 1, 2013 at 14:53

1 Answer 1

2

System.Web.Services.Protocols.SoapHeaderException: WSE012: The input was not a valid SOAP message because the following information is missing: action.

=> As per the above exception, I can say you forgot to set Action.

Try:

String SOAP_ACTION = "http://stockservice.contoso.com/wse/samples/2005/10/OCRWebServiceAvailablePages";
httppost.setHeader("SOAPAction", SOAP_ACTION);
Sign up to request clarification or add additional context in comments.

1 Comment

@user2443383 not an issue!! Enjoy

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.