Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Consuming web service results in “Unable to handle request without a valid action parameter”

I need to consume web services on this .NET site:

https://www.iyardiasp.com/8223third_17/webservices/ItfResidentData.asmx

For preliminary consumption I use either Fiddler or curl. Both give the same error:

<faultstring>Unable to handle request without a valid action parameter. Please supply a valid soap action.</faultstring> 

My curl command:

curl -d @GetVersionNumber.xml https://www.iyardiasp.com/8223third_17/webservices/ItfResidentData.asmx

Please see file GetVersionNumber.xml below:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
    <GetVersionNumber xmlns="http://tempuri.org/YSI.Interfaces.WebServices/ItfResidentData" />
</soap:Body>
</soap:Envelope>

Adding SOAP-ENV:Header as element in soap:Envelope does not help

<SOAP-ENV:Header Content-Type="text/xml" Host="www.iyardiasp.com" SOAPAction="http://tempuri.org/YSI.Interfaces.WebServices/ItfResidentData/GetVersionNumber"/>

Adding the Soap Action as a header does not help.

In this case the curl command is:

curl -H "SOAPAction: http://tempuri.org/YSI.Interfaces.WebServices/ItfResidentData/GetVersionNumber" -d @GetVersionNumber.xml "https://www.iyardiasp.com/8223third_17/webservices/itfapplicantscreening.asmx"

And the response is:

<faultstring>Server did not recognize the value of HTTP Header SOAPAction: http://tempuri.org/YSI.Interfaces.WebServices/ItfResidentData/GetVersionNumber.</faultstring>
like image 780
Alex Avatar asked Oct 03 '13 15:10

Alex


1 Answers

You need to supply the SOAPAction as a HTTP header, not a SOAP header. Here is how a complete request might look like when performed with SoapUI (notice the forth row):

POST /8223third_17/webservices/ItfResidentData.asmx HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "http://tempuri.org/YSI.Interfaces.WebServices/ItfResidentData/GetVersionNumber"
User-Agent: Jakarta Commons-HttpClient/3.1
Host: www.iyardiasp.com
Content-Length: 260

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:itf="http://tempuri.org/YSI.Interfaces.WebServices/ItfResidentData">
   <soapenv:Body>
      <itf:GetVersionNumber/>
   </soapenv:Body>
</soapenv:Envelope>

For curl you might use the -H parameter to send the SOAPAction header but I suggest you use SoapUI for your preliminary consumption (it includes the SOAPAction header by default and beats the console any day).

If you do need to use curl, try something like this (all must be on one line; separated for readability):

curl -H "Content-Type: text/xml;charset=UTF-8" 
     -H "SOAPAction: \"http://tempuri.org/YSI.Interfaces.WebServices/ItfResidentData/GetVersionNumber\"" 
     -d @GetVersionNumber.xml 
     https://www.iyardiasp.com/8223third_17/webservices/ItfResidentData.asmx

with this in the GetVersionNumber.xml file:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:itf="http://tempuri.org/YSI.Interfaces.WebServices/ItfResidentData">
   <soapenv:Body>
      <itf:GetVersionNumber/>
   </soapenv:Body>
</soapenv:Envelope>
like image 190
Bogdan Avatar answered Sep 26 '22 14:09

Bogdan