Streaming byte array (wodHttpDLX)
I need to send data as a Unicode UTF8 stream. Is this possible? What would the code look like?
Thanks
by AtlantaGator, (3363 days ago)
I need to send data as a Unicode UTF8 stream. Is this possible? What would the code look like?
Thanks
by Jasmine, (3363 days ago) @ AtlantaGator
Hi.
I don't think you can stream data with wodHttpDLX, since it is based on fixed-length request and responses.
I assume you want to broadcast video using the component? I don't think it can be used in that way.
Kind regards,
Jasmine.
by AtlantaGator, (3362 days ago) @ Jasmine
Jasmine,
Thanks for the reply.
What I meant by streaming is how data is sent through code.
I need to send a byte array to an api for credit card processing.
The data must be encoded (UTF8).
I am sending CC data plus the log in info.
I am unable to connect with the server.
I am able to connect using C# or VB.Net code without the HttpDLX object - using straight code.
BTW - I am using HttpDLX with VBA.
Thanks
by Jasmine, (3362 days ago) @ AtlantaGator
Hi.
Can you paste your C# code with dummy data, so I can see how it looks like, and try to translate it to wodHttpDLX?
Jasmine.
by AtlantaGator, (3362 days ago) @ Jasmine
Jasmine,
Thanks for your assistance.
Here is my code:
string mytran = "Login Credentials and CC Data";
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
// Create a request using a URL that can receive a post.
WebRequest request = WebRequest.Create("webaddress");
// Set the Method property of the request to POST.
request.Method = "POST";
// Create POST data and convert it to a byte array.
byte[] byteArray = Encoding.UTF8.GetBytes(mytran);
// Set the ContentType property of the WebRequest.
request.ContentType = "application/x-www-form-urlencoded";
// Set the ContentLength property of the WebRequest.
request.ContentLength = byteArray.Length;
Stream dataStream;
try
{
// Get the request stream.
dataStream = request.GetRequestStream();
// Write the data to the request stream.
dataStream.Write(byteArray, 0, byteArray.Length);
// Close the Stream object.
dataStream.Close();
}
catch (Exception f)
{
MessageBox.Show(f.ToString());
}
// Get the response.
WebResponse response = request.GetResponse();
// Get the stream containing content returned by the server.
dataStream = response.GetResponseStream();
// Open the stream using a StreamReader for easy access.
StreamReader reader = new StreamReader(dataStream);
// Read the content.
string responseFromServer = reader.ReadToEnd();
by Jasmine, (3362 days ago) @ AtlantaGator
Hi.
This should be pretty much straightforward, there's no stream of data, you can fill Request.Body with contents of stream. I assume stream isn't too large (in terms of megabytes) anyway.
So, something like this should do
Http1.Request.Headers.Add("Content-type: application/x-www-form-urlencoded")
Http1.Request.Body = "...put everything from the stream here"..
Http1.Post(URL)...
I think you don't need anything else. By default wodHttpDLX uses UTF8, but you can also specify it in Http1.Request.Charset if you wish, or you can write directly to Http1.Request.Filename (since Body actually internally reads/writes to it).
Can you try above?
Jasmine.
by AtlantaGator, (3362 days ago) @ Jasmine
Jasmine,
I get the same response as before: I don't have permission to access the server.
Since the server credentials are in the body, my assumption is that the server cannot read the body properly, like it can from C#.
I tried with 2 body arguments:
in one case I encoded the string, the other I did not - I sent the string unaltered
Could it be that I am using VBA and not VB?
Thanks
by Jasmine, (3362 days ago) @ AtlantaGator
Hi
VBA/VB cannot make a difference. Server don't know what you're using. Simply - data you are sending isn't same in both cases.
If you can somehow capture what you're sending in C# (such as with Fiddler) and then capture what you're sending with wodHttpDLX (with same Fiddler) you can spot the difference - and then just make the change in wodHttpDLX. It's usually just adding one header, changing body a bit or something simple.
Jasmine.
by AtlantaGator, (3362 days ago) @ Jasmine
Jasmine,
Excellent idea - I will be back - thanks.
by AtlantaGator, (3362 days ago) @ AtlantaGator
Jasmine,
What kind of data does the Http1.Request.Body expect ?
Can it handle a byte array ?
Will it know that the argument is an array?
Thanks
by Jasmine, (3362 days ago) @ AtlantaGator
Hi
Request.Body is a string. So, you can convert byte array to it. However, it could be safer and easier to you to write to Request.Filename file directly, so there's no conversion needed, just dump byte array to it and wodHttpDLX will use it.
Jasmine.

...wodFtpDlx was exactly what I needed, it worked, and it was priced right...

Just thought you'd like to know that my gateway app with your SMTP Server component held the line against a DDOS attack today...

I can only hope I will have the pleasure to work with other products by "We Only Do" in the future.

I've heard that you are amazing with your replies coming back so quickly - and now I've seen the speed in which you reply first hand.

The SFTP ocx is one of the finest pieces of programming I have seen. It worked out of the box...

...what I really like is that wodSSH and wodSFTP components work excellently and are constantly being improved...

You made it so simple for us to integrate SFTP - a technology we had little experience with...

Don't be fooled by the cost, it's value and quality far exceeds the price being charged!

Don't be fooled by the cost, it's value and quality far exceeds the price being charged!

...with the SFTP interface you produced, everything was so simple to understand, we were able to start coding almost immediately!

