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 ?)