Use OpenEdge.NET for streaming - Forum - OpenEdge Development - Progress Community
 Forum

Use OpenEdge.NET for streaming

This question is answered

Hi guys

I'm investigating how to streaming reports/PDF's from OpenEdge to a REST-service. That REST-service requires me to do streaming, but I can't find any support from streaming with the current HTTP implementation.

I'm wondering if anyone has done this before or if someone can give me some usefull pointers?

Verified Answer
  • Hi,

    I can't use System.NET because our backend also runs on Linux/Unix.

    And making calls from the client, by using System.NET, is not desireable because of the tight security measures that are in place nowadays.

    But... it turned out that the REST-service that I needed to call, is accepting the request from openedge. I used a Multipart message that contained one binary part, and it worked like a charm!!

    So thanks for your time everyone!

All Replies
  • Onno,
     
    What kind of streaming does the REST-service require?
     
    From PASOE you can return a response in HTTP chunks (https://tools.ietf.org/html/rfc2616#page-25) , by writing the output in pieces (so load PDF into a memptr, call Write(get-bytes(m, 1, 1024)) etc .
     
    The ABL HTTP client does not send data in chunks. It can consume chunked responses though. It is also not a streaming client since it is synchronous.
     
     
     
     
     
  • Hi Peter,

    This javascript example show how we would send data to it from postman for example. I'm wondering if i could mimic the same approach in OpenEdge?

    Regards, Onno

    var http = require("http");

    var options = {

     "method": "POST",

     "hostname": [

       "test",

       "test

     ],

     "path": [

       "api",

       "v1",

       "attachments"

     ],

     "headers": {

       "content-type": "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW",

       "Cache-Control": "no-cache",

       "Postman-Token": "8631da63-55e3-43f0-bdb4-1fee2cfca911"

     }

    };

    var req = http.request(options, function (res) {

     var chunks = [];

     res.on("data", function (chunk) {

       chunks.push(chunk);

     });

     res.on("end", function () {

       var body = Buffer.concat(chunks);

       console.log(body.toString());

     });

    });

    req.write("------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"attachment\"\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"attachment\"\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--");

    req.end();

  • onnodehaan

    Hi guys

    I'm investigating how to streaming reports/PDF's from OpenEdge to a REST-service. That REST-service requires me to do streaming, but I can't find any support from streaming with the current HTTP implementation.

    I'm wondering if anyone has done this before or if someone can give me some usefull pointers?

    Have you looked at System.Net.HttpWebRequest with the SendChunked set to true?

  • Hi,

    I can't use System.NET because our backend also runs on Linux/Unix.

    And making calls from the client, by using System.NET, is not desireable because of the tight security measures that are in place nowadays.

    But... it turned out that the REST-service that I needed to call, is accepting the request from openedge. I used a Multipart message that contained one binary part, and it worked like a charm!!

    So thanks for your time everyone!