What steps should I use to implement HTTP POST of an XML document?
Requirement: We have been given the ability to create Orders by creating an XML document. One of the methods available is "HTTP POST of an XML document".
What steps or tools can I use to create the "HTTP POST of an XML document"?
Thanks
XML
Last Comment
eeclint
8/22/2022 - Mon
Gary Davis
Well, let's assume your xml is in a file and you are writing a C# DotNET console application.
You can run this application from a command line and pass the filename as the first argument.
The program should read the xml as a string rather than load it into an XDocument since you want to post the xml to a destination url.
The program would then instantiate a WebClient and call the UploadString() method passing the url to the server and the xml string. This will do the post.
You can run this application from a command line and pass the filename as the first argument.
The program should read the xml as a string rather than load it into an XDocument since you want to post the xml to a destination url.
The program would then instantiate a WebClient and call the UploadString() method passing the url to the server and the xml string. This will do the post.
Additional details: http://msdn.microsoft.com/en-us/library/ekfaaeay(v=vs.100).aspx
Also, there is an UploadFile() method that may make this even easier since it will read the file for you.
Gary Davis