Getting no SOAPAction header error in sending a SOAP request as HTTP POST

Arun picture Arun · Apr 16, 2014 · Viewed 66.8k times · Source

I am sending a SOAP Request as HTTP POST in SOAPUI due to some project constraints. My Request is here :

POST httplink HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "urn:HPD_IncidentInterface_WS/HelpDesk_Query_Service"
Content-Length: 725
Host: itsm-mt-dev
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)


<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:HPD_IncidentInterface_WS">
   <soapenv:Header>
      <urn:AuthenticationInfo>
         <urn:userName>XXXXXXXXXX</urn:userName>
         <urn:password>XXXXXXXXX</urn:password>
         <!--Optional:-->
         <urn:authentication>?</urn:authentication>
         <!--Optional:-->
         <urn:locale>?</urn:locale>
         <!--Optional:-->
         <urn:timeZone>?</urn:timeZone>
      </urn:AuthenticationInfo>
   </soapenv:Header>
   <soapenv:Body>
      <urn:HelpDesk_Query_Service>
         <urn:Incident_Number>XXXXXXXXXX</urn:Incident_Number>
      </urn:HelpDesk_Query_Service>
   </soapenv:Body>
</soapenv:Envelope>

Although I had set SOAPAction header, still I am getting no SOAPAction header error.

Response as follows:

<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/">itsm-mt-dev</ns2:hostname>
         </detail>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>

Can anyone suggest me what we can do here ?

Answer

Abhishek Asthana picture Abhishek Asthana · Apr 17, 2014

It looks like you are sending an incorrect soapAction header. Look at the WSDL and find out the value for soapAction element for the service being tested.

In the WSDL look for a line similar to <soap:operation soapAction="http://example.com/GetLastTradePrice"/>.