用于使用webServices的Curl命令行?

el_*_*rdo 46 testing curl web-services

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

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

谢谢!

lbz*_*lbz 42

发布字符串:

curl -d "String to post" "http://www.example.com/target"
Run Code Online (Sandbox Code Playgroud)

发布文件内容:

curl -d @soap.xml "http://www.example.com/target"
Run Code Online (Sandbox Code Playgroud)

  • 通常这个标题也是必需的:-H"Content-Type:application/soap + xml; charset = UTF-8" (22认同)
  • 获取"HTTP/1.1 415不支持的媒体类型"意味着内容类型标题丢失或错误.尝试其中一个建议(`application/soap + xml`对我不起作用,但`text/xml`有效) (2认同)

Kri*_*s C 33

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

curl --header "content-type: application/soap+xml" --data @filetopost.xml http://domain/path
Run Code Online (Sandbox Code Playgroud)


Zib*_*bri 26

错误.这对我不起作用.

对我来说这个有用:

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
Run Code Online (Sandbox Code Playgroud)

  • 史诗!感谢您花时间发布ACTUAL工作示例! (3认同)

Ahm*_*aya 8

curl -H "Content-Type: text/xml; charset=utf-8" \
-H "SOAPAction:" \
-d @soap.txt -X POST http://someurl
Run Code Online (Sandbox Code Playgroud)