Results 1 to 2 of 2

Thread: XML via HTTP POST?

  1. #1

    Thread Starter
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359

    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]

  2. #2
    New Member
    Join Date
    Jul 2004
    Location
    Williamsport, PA
    Posts
    2

    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
    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
  •  



Click Here to Expand Forum to Full Width