你们知道如何使用 Curl 命令行 POST SOAP 来测试 Web 服务吗?

我有一个文件(soap.xml),其中附加了所有肥皂消息,我似乎无法正确发布它。

谢谢!

有帮助吗?

解决方案

发布字符串:

curl -d "String to post" "http://www.example.com/target"

发布文件的内容:

curl -d @soap.xml "http://www.example.com/target"

其他提示

对于 SOAP 1.2 Web 服务,我通常使用

curl --header "content-type: application/soap+xml" --data @filetopost.xml http://domain/path

错误的。那对我不起作用。

对我来说这个有效:

curl 
-H 'SOAPACTION: "urn:samsung.com:service:MainTVAgent2:1#CheckPIN"'   
-X POST 
-H 'Content-type: text/xml'   
-d @/tmp/pinrequest.xml 
192.168.1.5:52235/MainTVServer2/control/MainTVAgent2
curl -H "Content-Type: text/xml; charset=utf-8" \
-H "SOAPAction:" \
-d @soap.txt -X POST http://someurl

如果你想要一个比终端更蓬松的界面, http://hurl.it/ 太棒了。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top