|
-
Jul 19th, 2004, 07:20 AM
#1
Thread Starter
Retired VBF Adm1nistrator
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?
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Jul 19th, 2004, 08:10 AM
#2
New Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|