How to access SOAP services via CURL commandline

Posted: April 22, 2014 in linux, ubuntu
Tags: , , , , ,

Let’s assume you are running a SOAP service at the URL   http://localhost:8081/axis2/services/SimpleStockQuoteService?wsdl

SOAP UI  is a very good tool to access web services.

SoapUI 4.6.1 _095

However you have to install SOAP UI  or there may be situations where you don’t have access to tools, for instance when you have longed in to an server by SSH. Then you have access only to command line. Here come the curl command handy.

Let’s see how you can access the above web service using curl command.

curl  –header “Content-Type: text/xml;charset=UTF-8” –data @request.xml http://localhost:8081/axis2/services/SimpleStockQuoteService

(Please note that there are two (not one) dashes before parameters.)

request.xml files contains the request payload. Below is the payload for the SimpleStockQuoteService service.

<ser:getQuote xmlns:ser=”http://services.samples”&gt;
<!–Optional:–>
<ser:request>
<!–Optional:–>
<xsd:symbol>IBM</xsd:symbol>
</ser:request>
</ser:getQuote>

Advertisements
Comments
  1. Mike says:

    Awesome! Your guide helped me figure out how to query XML via CLI in a heartbeat. All other searches were baffling as I’m completely new to XML. Thank you so much! your article was excellent!!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s