Hi All,

I'm sending a SOAP request that requires to set a SOAPAction header.
Below is my code that I thought being correct. However, my WebServices server 
keeps on telling me that there's no SOAP Action..

I have tried in Fiddler to compose the same request, and by putting SOAPAction 
header in the composer, the server is able to return me the correct answer.
Is my code of setup SOAPAction header not correct? Please note that I'm using 
HTTPClient 4.0.3.

Any helps are welcome.

Thanks!
Xiaohui

My code:
                HttpClient httpClient = new DefaultHttpClient();
                httpClient.getParams().setParameter("Content-Type", "text/xml; 
charset=utf-8");
                httpClient.getParams().setParameter("SOAPAction", 
"mySOAPAction");

                String body = mySOAPBody";
                StringEntity requestBody = new StringEntity(body, "utf-8");
                requestBody.setContentType(new BasicHeader("Content-Type", 
"text/xml"));

                HttpPost request = new HttpPost(url);
                request.setEntity(requestBody);
                HttpResponse response = httpClient.execute(httpHost, request);

Server response:
<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";><soapenv:Body><soapenv:Fault><faultcode
 
xmlns:ns1="http://xml.apache.org/axis/";>ns1:Client.NoSOAPAction</faultcode><faultstring>no
 SOAPAction header!</faultstring><detail><ns2:hostname 
xmlns:ns2="http://xml.apache.org/axis/";>CRDB-DBSERVER</ns2:hostname></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>



Reply via email to