Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invoking SOAP request from shell command

Tags:

shell

soap

unix

I using curl to send a SOAP request to a web service and get the response using shell scripting. please find below the command i am using:-

curl  -H "Content-Type: text/xml; charset=utf-8" -H "SOAPAction:" -d @sample_request.txt -X POST http://someWebServiceURL

I am getting an error response which says no SOAPAction header. PFB the response body part

<soapenv:Body>
<soapenv:Fault>
<faultcode>Client.NoSOAPAction</faultcode>
<faultstring>WSWS3147E: Error: no SOAPAction header!</faultstring>
</soapenv:Fault>
</soapenv:Body>

Any help is appreciated !!

like image 667
Parameswar Avatar asked Apr 17 '12 07:04

Parameswar


2 Answers

You need to provide the name of the SOAP action. You have:

-H "SOAPAction:"

Supply the name of the action in there. E.g.

-H "SOAPAction: http://my_example/my_action"

Get the name of the action from the WSDL if you have one. E.g., see How do you determine a valid SoapAction?.

like image 101
Rich Drummond Avatar answered Sep 20 '22 12:09

Rich Drummond


From the WSDL of the service, you can find the SoapAction. And you can find the operation you're trying to invoke and access the WSDL by opening a web browser to the URL of the service. Using the curl to invoke the SoapAction, you should specify the Action by "-H", such as -H SOAPAction: http://tempuri.org/Execute.

like image 24
user1340688 Avatar answered Sep 19 '22 12:09

user1340688