Sunday, January 21, 2018

How to make a SOAP call through curl

This article explains the way to invoke a SOAP service through curl command and this may be useful when isolationg the issues in an integration environment.
 curl -ivs -H "Content-Type: text/xml; charset=utf-8" -d @test.xml -w "@performance-format.txt" -X POST 'http://192.168.1.5/test.asmx'   

Here, test.xml will be the message body of the request.
 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">  
   <soapenv:Header/>  
   <soapenv:Body>  
    <test/>  
   </soapenv:Body>  
 </soapenv:Envelope>  

performance-format.txt will be as below, this is to find out the request-response time.
 -----------------------------------------\n  
 url_effective: %{url_effective}\n   
 http_code: %{http_code}\n   
 content_type: %{content_type}\n   
 time_namelookup: %{time_namelookup}\n   
 time_connect: %{time_connect}\n   
 time_appconnect: %{time_appconnect}\n   
 time_pretransfer: %{time_pretransfer}\n   
 time_redirect: %{time_redirect}\n   
 time_starttransfer: %{time_starttransfer}\n   
 ----------------------------------------\n   
 time_total: %{time_total}\n   
 ----------------------------------------\n   


For more information on performance-format please refer [1].

[1] http://ajanthane.blogspot.com/2017/08/calculating-request-and-response-time.html

No comments:

Post a Comment