xml - Linux,Curl,发送不带 xml 文件的 -X POST

标签 xml linux curl

我在 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")

谢谢...

最佳答案

在文件名路径前使用@:

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'

关于xml - Linux,Curl,发送不带 xml 文件的 -X POST,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53315983/

相关文章:

php - 从特定 id 名称开始的 DOM 中获取 div 数据

Android - 超链接不可点击

c - 在 Linux 中检索网络摄像机流 URL

Android Layer-List Drawable 有两个项目未正确绘制且大小错误

linux - 如何使用 shell 从计算机注销?

linux - 使用 bash,我想在一行中打印一个数字,后跟 2 个路径的大小。即在一行上输出 3 个命令

PHP cURL 删除哈希标记后的片段

php - 如果包含通知负载,GCM ios 将无法正常工作

python - 如何在scrapy中的每一行写入重复元素

c# - 如何使用 RSA-SHA1 算法对 xml 元素进行签名?