简体   繁体   English

在Ubuntu中通过命令行访问SOAP Web服务

[英]Access SOAP webservice via Command Line in Ubuntu

I have a SOAP webservices. 我有一个SOAP Web服务。 I can call services from the application itself. 我可以从应用程序本身调用服务。 But now I have requirement such that it can be called internally for the server itself. 但是现在我有一个要求,使得可以在服务器本身内部调用它。

In other word I need a way to call this service from Linux command line. 换句话说,我需要一种从Linux命令行调用此服务的方法。 I heard curl command can do it. 我听说curl命令可以做到。 But I am not sure what are the things I need to take care for curl to work/ 但是我不确定要使卷毛正常工作需要做什么护理/

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>

I am not sure what curl command will allow to call this webservice. 我不确定使用什么curl命令可以调用此Web服务。

you can use the following command to invoke the web service from linux terminal. 您可以使用以下命令从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 will be used to define the soap request message with required parameters. your_soap_request.xml将用于使用必需的参数定义肥皂请求消息。 change the values accordingly. 相应地更改值。

your_soap_request.xml 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>

hope this will be helpful for you. 希望对您有帮助。 let me know if you have any query 让我知道你是否有任何疑问

Thanks 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM