Web services 使用Web服务的Curl命令行?

Web services 使用Web服务的Curl命令行?,web-services,testing,curl,Web Services,Testing,Curl,你们知道我如何使用Curl命令行发布SOAP来测试web服务吗 我有一个文件(soap.xml),它附带了所有的soap消息,但我似乎无法正确地发布它 谢谢 发布字符串: curl -d "String to post" "http://www.example.com/target" 发布文件内容: curl -d @soap.xml "http://www.example.com/target" 如果您想要一个比终端更流畅的界面,那就太棒了。对于SOAP 1.2 Web服务,我通常使用 c

你们知道我如何使用Curl命令行发布SOAP来测试web服务吗

我有一个文件(soap.xml),它附带了所有的soap消息,但我似乎无法正确地发布它

谢谢

发布字符串:

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

通常此标头也是必需的:-H“内容类型:应用程序/soap+xml;字符集=UTF-8”获取
HTTP/1.1 415不支持的媒体类型
表示内容类型标头缺失或错误。试试这里建议的一个(
application/soap+xml
对我不起作用,但
text/xml
起作用),我还必须添加
;行动=http://tempuri.org/WhateverAction
内容类型
标题.epic!感谢您花时间发布实际的工作示例!这对我有用。但是,我需要从文件中读取soap.txt中的值
code
code
-d@soap.txt
参数提供您想要的内容。
curl -H "Content-Type: text/xml; charset=utf-8" \
-H "SOAPAction:" \
-d @soap.txt -X POST http://someurl