11

我使用 curl 向 Web 服务发送 SOAP 请求并使用 shell 脚本获取响应。请在下面找到我正在使用的命令:-

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

我收到一个错误响应,上面写着没有 SOAPAction 标头。PFB 响应正文部分

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

任何帮助表示赞赏!

4

2 回答 2

12

您需要提供 SOAP 操作的名称。你有:

-H "SOAPAction:"

在其中提供操作的名称。例如

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

如果有,从 WSDL 获取操作的名称。例如,请参阅如何确定有效的 SoapAction?.

于 2012-04-17T07:22:00.310 回答
1

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.

于 2012-04-18T08:00:05.270 回答