cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Howto question - SOAP on the command line

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Tue, 19 Apr 2005 22:48:11 +0200 (CEST)

On Tue, 19 Apr 2005, Dan White wrote:

> I would like to use curl (on a command line/in a script) to do the
> equivalent of this wget command :
>
> wget --http-user='username' --http-passwd='password' --post-file='soap.xml'
> --header='Accept-Encoding:gzip'
> http://datadirect.webservices.zap2it.com/tvlistings/xtvdService
> --output-document=outputFile.gz

Without being a wget wizard, I would say that the curl equivalent would be:

  curl -u username:password -d @soap.xml --compressed -o outputFile
http://datadirect.webservices.zap2it.com/tvlistings/xtvdService

This would ask for a compressed response and automatically unpack it on
retrieval and store the uncompressed version in the given output file
(assuming curl was built with libz support enabled).

People that sends XML often wants to change content-type as well, like -H
"Content-Type: text/xml".

Note that this makes a POST and it sends the file "raw" with no encoding done
what so ever.

Append --trace-ascii to see exactly what curl sends and receives.

> Or should I just go straight to the library ?

I recommend smoothing it out with the curl tool first, but that's mostly a
matter of taste.

Good luck!

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2005-04-19