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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
icePhalanxAuthor Commented:
Thanks!  I put the xml string in quotes and it worked.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
File Sharing Software

From novice to tech pro — start learning today.