18 November 2013

Request WebService simply with cURL

If you have a webservice you need to consume, you can simply test it using cURL as follows:

-d 'soap request, you can create yourself, or let any tool create it for you, Eclipse can do.'
-H "Content-Type: text/xml; charset=utf-8" -- Content type, and you should specify it.
then the webservice URL, for example http://www.w3schools.com/webservices/tempconvert.asmx


curl -d '<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <CelsiusToFahrenheit xmlns="http://www.w3schools.com/webservices/"> <Celsius>20</Celsius> </CelsiusToFahrenheit> </soap:Body> </soap:Envelope>' -H "Content-Type: text/xml; charset=utf-8" http://www.w3schools.com/webservices/tempconvert.asmx
Post a Comment