Thursday, 30 June 2016

How to test web service using command line curl

How to test web service using command line curl.

How to test web service using command line curl, is a very often requirement.

This is always very easy to call the web service via a java client,  but sometimes we need to call the service using curl.

One thing you know ? its really very tactical to  call the web service from terminal/command line using curl command.

I have  steps with sample example :-

You need to know the below things before calling the service via curl.

Service Endpoint - The web service endpoint you want to call.

Example -

Operation Name - The operation name , you want to execute.

Example - readProviderRequest

SoapAction - The soap action defined in WSDL.

Example - SOAPAction:/NaaSAutomation/Resources/WSDLs/ESB/Service/NaaSManageService-service0.serviceagent/NaaSManageServicePortEndpoint0/ManageProviderRead

Create sample valid request xml for sending to the service.


<soapenv:Envelope xmlns:soapenv="" xmlns:dto="">

Curl Command :-

curl --header "Content-Type: text/xml;charset=UTF-8" --header "SOAPAction:/NaaSAutomation/Resources/WSDLs/ESB/Service/NaaSManageService-service0.serviceagent/NaaSManageServicePortEndpoint0/ManageProviderRead" --data @Request.xml

Response got from Curl :-

<SOAP-ENV:Envelope xmlns:SOAP-ENV="">
      <ns0:ManageProviderCreateRes xmlns:ns0="">

Hope it will help you.
Follow for more details on Google+ and @Facebook!!!

Find More :-

No comments:

Post a Comment