Results 1 to 2 of 2

Thread: [2005] Send XML document as Request Parameter

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2005
    Posts
    625

    [2005] Send XML document as Request Parameter

    How do I send an XML document as a request parameter? Here's some pseudo code of what I have so far:

    I'm using the XMLDocument Object, then using 'OuterXML' I get the document as a string : strXMLdoc


    url = "http://myurl.com"

    strpost = "xml=" & HttpUtility.UrlEncode(strXMLdoc)

    I set the content type to 'text/xml'

    And to send :

    Dim encoding As New System.Text.UTF8Encoding

    Dim byte1 As Byte() = encoding.GetBytes(strpost)
    Dim newStream As Stream = objRequest.GetRequestStream()
    newStream.Write(byte1, 0, byte1.Length)
    newStream.Close()



    Then I use the Request object and Stream - which works in all other cases so I know that part is right.

    Is there anything wrong with the above? I will post more of the code if its not obvious (like am I using the wrong content type or encoding, or am I doing a 'double' encoding (using httputility and UTF8 ?)

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2005] Send XML document as Request Parameter

    As a request parameter? Are you sure you have your terminology right?

    As a request parameter would mean that you're sending it to another page and want to pass it either by GET or POST.

    Your code appears to be writing the XML out; as though you want a user to browse to your page and it should appear as an XML document to them. Is that what you're trying?

    As for your code, more could would help, yes.

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