Simple HTTP POST .Net web service?
Hello,
A customer of ours wants us to provide a web service that they can access WITHOUT SOAP. They just want to do an HTTP POST to some URL I provide. They will put the XML in the data of the post. We want to do this in .NET in C#.
OK, so I figured out how to do it, but it seems very backward. I keep thinking there is a better way. Here is what we did:
1) We have a .NET web service that takes NO parameters.
2) It gets the XML with the following lines:
String postData = this.Context.Request.Form.ToString();
sxml = System.Web.HttpUtility.UrlDecode(postData);
3) Then, it uses standard XML tools to extract the data from his XML:
doc.LoadXml(sxml);
XmlNodeList nodeLst = doc.GetElementsByTagName("OrderInfo");
... etc.
4) Finally, it builds an XML result string (a character string) and returns it with
return sResult;
Is this the best way to hanlde this? It seems that I'm bypassing all of the cool .NET web service tools by getting it from the Request.Form.Tostring. But I don't see a better way.
Also (an annoyance I'll probably figure out sooner or later) when it comes back to him he is seen > instead of GREATER THAN and < instead of LESS THAN in the XML result string. Which setting is causing that to happen?
Thanks much!
Dave
|