Solved

HTTP Post keep alive and chunked

Posted on 2013-06-17
3
678 Views
Last Modified: 2013-06-18
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

 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

Open in new window

0
Comment
Question by:lrbrister
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 80

Accepted Solution

by:
David Johnson, CD, MVP earned 500 total points
ID: 39255020
Each chunk starts with the number of octets of the data it embeds expressed in hexadecimal followed by optional parameters (chunk extension) and a terminating CRLF (carriage return and line feed) sequence, followed by the chunk data. The last chunk is a zero-length chunk, with the chunk size coded as 0, but without any chunk data section.

http://blogs.msdn.com/b/asiatech/archive/2011/04/26/how-to-write-chunked-transfer-encoding-web-response.aspx
0
 

Author Comment

by:lrbrister
ID: 39256042
ve3ofa,

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

Author Closing Comment

by:lrbrister
ID: 39257487
I wasn;t clear enough.
This gives me the information, but in a different environment
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Access Schema 6 45
How to use Visual Studio's AddArgument method found in the PowerShell Namespace 2 31
Header Font Size in Grid View 6 27
VB.Net Data Class 1 23
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question