Link to home
Start Free TrialLog in
Avatar of eeclint
eeclint

asked on

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
Avatar of Gary Davis
Gary Davis
Flag of United States of America image

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.

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
Avatar of eeclint
eeclint

ASKER

Hi Gary,

Thanks for your response.

Are there any sample pieces of code that I can use & then plugin my XML data using the C#  DotNET console application ?

I'm not an expert in C# ?

Thanks again.
ASKER CERTIFIED SOLUTION
Avatar of Gary Davis
Gary Davis
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of eeclint

ASKER

Hi Gary,

Thanks for the code. I'll give it a shot & ask more questions if I get stuck later.

Thanks again.