【发布时间】:2018-11-15 09:16:10
【问题描述】:
我在 Linux 中有一个小 sh 脚本,用于带有 curl 的 -X POST:
curl -X POST http://serverip:8081/WebServices/WebServiceSQLTestresult.svc?wsdl -H "Content-Type: text/xml; charset="utf-8"" -H "SOAPAction: "http://tempuri.org/IWebServiceSQLTestresult/InsertPruefResultatFromXMLFile"" --data @\u\ManInTheMiddle.xml | grep -o 'true\|false'
这很好,但我必须先编写 ManInTheMiddle.xml,第二步我可以发送 curl 命令。
ManInTheMiddle.xml
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<InsertPruefResultatFromXMLFile xmlns="http://tempuri.org/">
<FilePath>\\serverip\script.xml</FilePath>
</InsertPruefResultatFromXMLFile>
</Body>
</Envelope>
有没有办法在没有 xml 文件的情况下做到这一点?直接发送“\serverip\script.xml”
喜欢:
curl -X POST http://serverip:8081/WebServices/WebServiceSQLTestresult.svc?wsdl -H "Content-Type: text/xml; charset="utf-8"" -H "SOAPAction: "http://tempuri.org/IWebServiceSQLTestresult/InsertPruefResultatFromXMLFile"" --d "\\serverip\script.xml" | grep -o 'true\|false'
有什么想法吗?
编辑1: 我只想用 ManInTheMiddle.xml 处理中间步骤,以便服务器直接获取到导入文件 (\serverip\script.xml) 的链接。
编辑2: 使用 python 它可以工作:
url = "http://serverip/WebServices/WebServiceSQLTestresult.svc?wsdl"
import suds
import suds.client
client = suds.client.Client(url)
result = client.service.InsertPruefResultatFromXMLFile("\\\\serverip\script.xml")
谢谢...
【问题讨论】:
-
您询问是否可以直接发送
\\serverip\script.xml,而不是发送请求以要求服务使用\\serverip\script.xml语法从Windows 共享文件夹加载该文件。但我们对http://serverip:8081/WebServices/WebServiceSQLTestresult.svc?wsdl服务一无所知,因此无法回答。您需要去与编写此 Web 服务的人交谈并询问他们 - 我们不知道该服务是如何工作的。 -
好的,所以我对 curl 有了更多的了解...谢谢...我想如果服务器的文件或链接相同。