【发布时间】:2010-09-10 04:27:24
【问题描述】:
你们知道我如何使用 Curl 命令行 POST SOAP 来测试 Web 服务吗?
我有一个文件 (soap.xml),其中附有所有的肥皂消息,但我似乎无法正确发布它。
谢谢!
【问题讨论】:
标签: web-services testing curl
你们知道我如何使用 Curl 命令行 POST SOAP 来测试 Web 服务吗?
我有一个文件 (soap.xml),其中附有所有的肥皂消息,但我似乎无法正确发布它。
谢谢!
【问题讨论】:
标签: web-services testing curl
错了。 这对我不起作用。
对我来说,这个可行:
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
【讨论】:
code code
-d @soap.txt 参数提供你想要的。
对于 SOAP 1.2 Web 服务,我通常使用
curl --header "content-type: application/soap+xml" --data @filetopost.xml http://domain/path
【讨论】:
如果你想要一个比终端更流畅的界面,http://hurl.it/ 很棒。
【讨论】:
发布一个字符串:
curl -d "String to post" "http://www.example.com/target"
发布文件内容:
curl -d @soap.xml "http://www.example.com/target"
【讨论】:
HTTP/1.1 415 Unsupported Media Type 表示内容类型标头丢失或错误。试试这里建议的方法之一(application/soap+xml 对我不起作用,但text/xml 起作用)
; action=http://tempuri.org/WhateverAction 添加到Content-Type 标题中。