Larry Brister
asked on
HTTP Post keep alive and chunked
In Visual Basic ....VB.Net, or Windows Service whatever...
I need to post some XML using the following setup
Instructions: "HTTP chunked encoding includes the header "Transfer-Encoding:chunked " and the length of the chunk (plus newline) before actual chunk"
POST /bot1/bot1 HTTP/1.1
Host: costed.theConnNet.com
Connection: keep-alive
Content-Type: text/plain
Transfer-Encoding: chunked
Lets say for example I need to post this
<root>
<clientID> 123</clientID>
<inStat>Yes></inStat>
<root>
I have this so far...but not sure what to do with the code between the ======= marks and how to implement the
"length of chunk plus new line" part
I need to post some XML using the following setup
Instructions: "HTTP chunked encoding includes the header "Transfer-Encoding:chunked
POST /bot1/bot1 HTTP/1.1
Host: costed.theConnNet.com
Connection: keep-alive
Content-Type: text/plain
Transfer-Encoding: chunked
Lets say for example I need to post this
<root>
<clientID> 123</clientID>
<inStat>Yes></inStat>
<root>
I have this so far...but not sure what to do with the code between the ======= marks and how to implement the
"length of chunk plus new line" part
Public Sub GetXmlChunkedData(ByVal URI As String, ByVal Parameters As String)
Dim req As System.Net.WebRequest = System.Net.WebRequest.Create(URI)
Dim request As HttpWebRequest
Dim response As HttpWebResponse = Nothing
Try
' Create the web request
request = DirectCast(WebRequest.Create(URI), HttpWebRequest)
request.ContentType = "text/plain"
request.Method = "POST"
request.KeepAlive = True
request.TransferEncoding = "chunked"
request.UserAgent = "CometTest"
'===========================================================================
'Dim bytes As Byte() = System.Text.Encoding.ASCII.GetBytes(Parameters)
'request.ContentLength = bytes.Length
'Dim os As System.IO.Stream = request.GetRequestStream()
'os.Write(bytes, 0, bytes.Length)
'os.Close()
'' Get response
'response = DirectCast(request.GetResponse(), HttpWebResponse)
'' Load data somewhere
'============================================================================
Finally
If Not response Is Nothing Then response.Close()
End Try
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I wasn;t clear enough.
This gives me the information, but in a different environment
This gives me the information, but in a different environment
ASKER
Ok...I recognized the vowels and consonets.
But little else in your answer.
I need to do this in Visual Basic. You have a different link?