linux - 在 Ubuntu 中通过命令行访问 SOAP web 服务

标签 linux web-services curl soap command-line

我有一个 SOAP 网络服务。我可以从应用程序本身调用服务。但现在我有这样的要求,它可以在内部为服务器本身调用。

换句话说,我需要一种从 Linux 命令行调用此服务的方法。我听说 curl 命令可以做到。但是我不确定要让 curl 工作我需要注意什么/

ID: 1
Address: http://localhost:9000/sampleApp/hellome
Encoding: UTF-8
Http-Method: POST
Content-Type: text/xml
Headers: {Accept=[*/*], SOAPAction=[""]}
Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns1:sayHelloWithTime xmlns:ns1="http://hello.sample.com"><ns1:timeOfDay>2015-02-05T00:00:00-05:00</ns1:timeOfDay></ns1:sayHelloWithTime></soap:Body></soap:Envelope>

我不确定哪个 curl 命令将允许调用此网络服务。

最佳答案

您可以使用以下命令从 linux 终端调用 Web 服务。

curl -H "Content-Type: text/xml; charset=utf-8" -H "SOAPAction:"  -d @your_soap_request.xml -X POST http://localhost:9000/sampleApp/hellome

your_soap_request.xml 将用于定义带有必需参数的 soap 请求消息。相应地更改值。

your_soap_request.xml

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:impl="XXXXCHANGEXXXXXX">
   <soapenv:Header/>
   <soapenv:Body>
      <impl:methodName>
         <arg0>XXXXXX</arg0>
      </impl:methodName>
   </soapenv:Body>
</soapenv:Envelope>

希望对您有所帮助。 如果您有任何疑问,请告诉我

谢谢

关于linux - 在 Ubuntu 中通过命令行访问 SOAP web 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28375592/

相关文章:

linux - 有没有办法在 Linux 上构建没有文本重定位的 libxml2?

基于 jQuery AJAX SOAP 的 Web 服务和 CORS(跨源资源共享)

c++ - 如何使用 cURL 检查网络连接

linux - 在 Internet 存档上重定向后获取 URL

linux -/bin/bash 版本太低,如何在登录时使用不同版本的 bash 获取点文件

linux - 配置 linux 输出流

c - 如何像 shmget 一样在内存中重新映射文​​件 mmap(2)-ed

java - 我是否需要对 Web 服务请求调度程序 (Java) 进行单元测试?

web-services - 如何为从移动应用程序调用的 ColdFusion Web 服务实现用户身份验证?

php - Mailchimp API v3.0 添加待处理成员无需确认电子邮件