Consuming web service using Unix curl


We are trying to consume a web service from our Linux box using the curl command but are stuck with the syntax.

The web service is expecting the xml to be fed in via a string and we have tried the following:

curl -h "Content-Type: text/xml"<XMLDATA>TEST</XMLDATA>&ConfirmFlag=Confirmed

The above authenticates with the web service when using curl, but complains with HTTP 400 bad request.  The above url works perfectly if I put it directly into a browser.

Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

Rance_HallConnect With a Mentor Commented:
Can you configure the web service to echo back the "bad url"  this will give you the best clue about whats broken with what you tried to do.

My first thought is that you might need to "escape" characters in the url that have special meaning to the shell/script the command is executed in something like

or put the url itself into quotes so that the system doesnt try to process the special characters that are not quoted.

icePhalanxAuthor Commented:
Thanks!  I put the xml string in quotes and it worked.
All Courses

From novice to tech pro — start learning today.