2011-12-13 47 views
11

我可以使用CURL从Linux命令行调用Web服务。 现在我尝试使用wget来调用Web服务,但我总是收到以下错误: 500内部服务器错误使用wget调用Web服务

我使用的语法如下:

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. 

回答

0

你与SOAP一起提交有效载荷?您是否尝试使用SOAPUI Client检查是否有成功的响应?

+0

是的:如果我使用SoapUI提交相同的有效载荷,服务器给我一个正确的回应。 – matteogll

4

我不得不使用--header="Content-Type: text/xml"

15

你不提它的网络服务器您正在使用或如何您的网址的格式,但调用.NET编写的IIS Web服务操作使用此语法:

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上的操作创建的信息页面中找到。

+0

这帮助我很多。在JBossWS中运行良好。 –