Florent Bayle


1 note

Call SOAP web services using wget

When testing web services, it can be useful to quickly replay a request, or to use cron to check if a web service is up and running. You can use wget for that purpose.

Here is how :

  • Create a file containing your SOAP request. Here is the request to call the Flickr echo web service. Put that code in a file named request.xml :
            <x:FlickrRequest xmlns:x="urn:flickr">
  • Call wget with the correct content type, and specify your file as the content of the POST :

    wget http://api.flickr.com/services/soap/ —post-file=request.xml —header=”Content-Type: text/xml” -O response.xml

This will save the result as a file named response.xml.

Filed under tech