-
XML via HTTP POST?
Righty. I've been given an API specification for a particular web service. I know that I have to send their service some XML, and it'll send some back. And then theirs will connect back to mine and send some XML.
Assuming that I will be given a URL to their service, and I give them a URL to mine - how do I actually send an arbitrary section of XML via HTTP POST to something?
If I create a pretend form and send the data by post it'll just send it as normal html crap post - so how do I actually send XML?
-
Try this out
It should go something like this:
Dim myRequest As HttpWebRequest = CType(HttpWebRequest.Create("http://www.creditcardgateway.com/"), HttpWebRequest)
myRequest.AllowAutoRedirect = False
myRequest.Method = "POST"
myRequest.ContentType = "application/x-www-form-urlencoded"
'Create post stream
Dim RequestStream As Stream = myRequest.GetRequestStream()
Dim SomeBytes() As Byte = Encoding.UTF8.GetBytes(strToSend)
RequestStream.Write(SomeBytes, 0, SomeBytes.Length)
RequestStream.Close()
'Send request and get response
Dim myResponse As HttpWebResponse = CType(myRequest.GetResponse(), HttpWebResponse)
Regards,
Aeros