我可以使用 CURL 从 Linux 命令行调用 Web 服务。
现在我正在尝试使用 wget 来调用 Web 服务,但我总是收到以下错误:
500 内部服务器错误 .
我使用以下语法:
wget http://<endPoint> --post-file=soapRequest.xml --header="Content-Type: application/soap+xml" --output-document=soapResponse.xml
其中soapRequest.xml 包含XML 请求(由SoapUI 验证)。
wget 返回的错误是:
Connecting to <host:port>... connected.
HTTP request sent, awaiting response... 500 Internal Server Error
2011-12-12 23:18:33 ERROR 500: Internal Server Error.
最佳答案
您没有提到您使用的是哪个网络服务器,或者您的 URL 是如何格式化的,但是要在 IIS 上调用用 .NET 编写的网络服务操作,请使用以下语法:
wget --post-file=soaprequest.xml --header="Content-Type: text/xml" --header="SOAPAction: \"soapaction\"" http://server/app/myservice.asmx -O response.xml
“
soapaction
”值可以在 WSDL 中找到,也可以在 ASP.NET 为操作创建的信息页面 myservice.asmx
中找到。 .
关于web-services - 使用 wget 调用 Web 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8486516/