curl is a software designed to deal with HTTP protocol. When it comes to REST, we could send request quite easily with curl. However , although it is not straight forward you could use curl for sending SOAP messages too. This method could not used for day to day use, but it is very useful when it come to testing. If you need to test a service, it is more or less the same request send to server. First you need to get soap request into a file (say echo.xml) and then send it to the service URI.
curl -d @echo.xml -H "Content-Type: application/soap+xml;charset=UTF-8 "
http://localhost:9090/axis2/services/echo
An advantage with this method is , you could deal with HTTP related things very easily. Say if you need to send additional HTTP header with soap request, you could do it with "-H" option.
curl -d @echo.xml -H "Content-Type: application/soap+xml;charset=UTF-8" -H "User-Agent:Apache Axis2/C"
http://localhost:9090/axis2/services/echo
and will be able to do modifications to SOAP payload quite easily. (Need to edit echo.xml file only :) )
6 comments:
one pointer for people trying to do this is to 'urlencode' the message before sending.
it is really cool thing to test soap services.
Thanks
hi guys
i very new to curl
i want to test my WCF Service (SOAP 1.1) with curl
can u provide me the basic sample on this
Very helpful, thank you for providing it. I will say, though, that I think one wants to urlencode the data fields, but not necessarily the entire message.
need help:
I installed axis2/c on ubuntu. and http://localhost:9090/axis2c/services looks fine.
curl -H "Content-Type: application/soap+xml;charset=UTF-8 " http://localhost:9090/axis2c/services
The above command looks fine.
But ran the command I got error:
curl -d '' -H "Content-Type: application/soap+xml;charset=UTF-8 " http://localhost:9090/axis2c/services/echo
Error:
soapenv:SenderSOAP message does not contain a SOAP envelope element
Any help, please,
george
Post a Comment