Question : Create Webservice to receive XML using HttpWebRequest

OK Gurus, I am need of some serious help REAL FAST.

I inherited a project that is due in 2 weeks and there is PLENTY more to code.

Solution Overview:
A Web development company has written a front end e-commerce solution and my company wants me to design a webservice that can be instantianted on their end, and I receive an xml version of the order on my end. Their website is developed in PHP and they don't currently wrap the xml in a soap header (but have said if it was necessary they could)

Steps taken so far:
I have written a webservice (similar to what you would write in VS2005) in VS2008.
Currently, I am able to take an example order that was sent me, toss it into a XmlReader.Create("C:\Order.xml") and am able to parse out the values and insert records into our SQL tables.

What I need, and have not been able to find, is to be able to receive a Form Post from the ecommerce order page that calls my webservice and receives the xml of the order placed into my webservice for parsing.

From what I've seen many people are using the HttpWebRequest object, but I'm not sure how to use this.
This is my feeble attempt at trying to use this object.

Dim req As System.Net.HttpWebRequest
Dim targetURI As New Uri("http://www.jensenrvdirect2.com/catalogsearch/result/")

req = DirectCast(System.Net.HttpWebRequest.Create(targetURI), System.Net.HttpWebRequest)

If (req.GetResponse().ContentLength > 0) Then
      Dim str As New System.IO.StreamReader(req.GetResponse().GetResponseStream())
      Dim Myreader As XmlReader = XmlReader.Create(str)

      Myreader.Close()
      str.Close()

      Return "Success"
End If

Please help me clean this up and get it functional.
I've spent many hours researching this with no avail.
I'm also not looking for quick links to microsoft on the HTTPWebRequest, I need guidance to what Im doing wrong.

I'll give 500 pts to start on this.
Thanks for your quick response.

Answer : Create Webservice to receive XML using HttpWebRequest

If you ar writing web service then form post is not a concerned as in the web service you would have make a function to be public which can be consumed and in the function you can return either XML as whole string or some object which is common at both end.

Regarding HTTPWebRequest, These implementations are also in place but the implementatin may be bit different. Well I can say i did it bit differently.
Step 1. Create a  dummy page. say dataCollector.aspx (.Net)
Step 2. In the pageload you can check what request is coming for your page and you can verify different parameters sent in query string or the request stream.
Step 3. Get the response object and set the required data may in XML in the response stream and set the content type accordingly.

Now at client end either use JavaScript (XMLHttpWebRequest) or normal HTTPWebRequest.

Hope this helps :)
Random Solutions  
 
programming4us programming4us