user2443383
user2443383

Reputation:

Getting Exception while calling soap webservice

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.

Upvotes: 0

Views: 2378

Answers (1)

Paresh Mayani
Paresh Mayani

Reputation: 128428

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);

Upvotes: 2

Related Questions