http - 通过 curl 发出肥皂请求不起作用并且服务器返回“来自服务器的空回复”
问题描述
嗨,我正在尝试使用 curl 向肥皂端点发出发布请求。但是它不返回任何东西。然后是 curl 请求。
curl -v -X POST --header "Content-Type: text/xml;charset=UTF-8" --data @soap-req.xml http://192.168.123.219:8085/engage/stats
Note: Unnecessary use of -X or --request, POST is already inferred.
* Trying 192.168.123.219...
* TCP_NODELAY set
* Connected to 192.168.123.219 (192.168.123.219) port 8085 (#0)
> POST /engage/stats HTTP/1.1
> Host: 192.168.123.219:8085
> User-Agent: curl/7.54.0
> Accept: */*
> Content-Type: text/xml;charset=UTF-8
> Content-Length: 309
>
* upload completely sent off: 309 out of 309 bytes
* Empty reply from server
* Connection #0 to host 192.168.123.219 left intact
curl: (52) Empty reply from server
以下是soap request 9 soap-req.xml文件的内容
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:eng="http://openmindnetworks.com/engage/">
<soapenv:Header/>
<soapenv:Body>
<eng:getCampaignStats>
<id>f4202b29-5db5-4cec-965f-70710fcdb60d</id>
</eng:getCampaignStats>
</soapenv:Body>
</soapenv:Envelope>
但是,当我使用肥皂 UI 时,它工作正常。
如果您能帮我解决问题,不胜感激
谢谢你
解决方案
每当我提出肥皂请求时,我们都应该始终添加soapaction 标头。因为它丢失了,所以服务器的响应是空的。
curl -H 'Content-Type: application/soap+xml; charset=UTF-8'
-H 'SOAPAction: http://openmindnetworks.com/engage/getCampaignStats'
--data @soap-req.xml http://192.168.123.219:8085/engage/stats
推荐阅读
- python - Spyder4找不到seaborn包
- actions-on-google - 如何将“自由格式文本”类型从区分大小写更改?
- dfa - 用于 Kleene 星操作的 DFA
- javascript - 在 Google 表格中解析表格,然后将所有匹配的行数据存储在一个数组中,我可以从中提取信息(GAS/JavaScript)
- opencv - 这是 ARUCO 板估计的正常不稳定量吗?(视频示例)
- html - 垂直菜单中的图像未与菜单容器对齐
- javascript - 如何通过ajax调用数据来扩展表格行以获取更多信息
- python - 安装 PyAudio 给出错误“portaudio.h”文件未找到
- xml - Foreach 循环将元素添加到 XML
- python - Python 父文件夹导入