http - How do I POST XML data with curl -


i want post xml data curl. don't care forms said in how make post request curl.

i want post xml content webservice using curl command line interface. like:

curl -h "text/xml" -d "<xmlcontainer xmlns='sads'..." http://myapiurl.com/service.svc/ 

the above sample cannot processed service.


reference example in c#:

webrequest req = httpwebrequest.create("http://myapiurl.com/service.svc/"); req.method = "post"; req.contenttype = "text/xml"; using(stream s = req.getrequeststream()) {     using (streamwriter sw = new streamwriter(s))         sw.write(myxmlcontent); } using (stream s = req.getresponse().getresponsestream()) {     using (streamreader sr = new streamreader(s))         messagebox.show(sr.readtoend()); } 

-h "text/xml" isn't valid header. need provide full header:

-h "content-type: text/xml"  

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -