1. Jan Chmelař
  2. PowerBuilder
  3. Friday, 16 June 2023 06:54 AM UTC

Hello, everyone.
I am looking for a way to transfer large binary files (>100MB) both ways using a web service as a client in PB19R3. For example with the help of stream, see below the client code in C#.  Is this a reasonable solution and how to rewrite it in PowerBuilder? Or is it better to use other methods? HttpCLient? RestClient? Right now it's written via OLE "xmlhttp.connecttonewobject("Msxml2.ServerXMLHTTP.6.0")".
Thank you for your answer or tips.

Code in C#:

using (FileStream fsSource = new FileStream(ulozitDokumentPozadavek.CestaKSouboru, FileMode.Open, FileAccess.Read))
{
  var pozadavek = new Sluzba.Dms.Rozhrani.Funkce.UlozitDokumentStreamPozadavek();
  pozadavek.KlicovaSlova = "Klíčová slova";
  FileInfo fileInfo = new FileInfo(ulozitDokumentPozadavek.CestaKSouboru);
  pozadavek.NazevSouboruSPriponou = fileInfo.FullName;
  pozadavek.Stream = fsSource;
  pozadavek.OsobaId = KlientSluzby.AktivniInstanceServeru.OsobaId;
  pozadavek.Predmet = "Pokusný předmět";
  pozadavek.SlozkaId = KlientSluzby.AktivniInstanceServeru.SlozkaId;
  var odpoved = KlientSluzby.Sluzba.UlozitDokumentStream(pozadavek);
}

Test XML from SOAPUI:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
   <soapenv:Header>
      <tem:Velikost>39</tem:Velikost>
      <tem:SlozkaId>17</tem:SlozkaId>
      <tem:Predmet>Test</tem:Predmet>
      <tem:OsobaId>2</tem:OsobaId>
      <tem:NazevSouboruSPriponou>pokus.txt</tem:NazevSouboruSPriponou>
      <tem:KlicovaSlova>Vesmir, Galaxie, Dalka</tem:KlicovaSlova>
   </soapenv:Header>
   <soapenv:Body>
      <tem:UlozitDokumentStreamPozadavek>
         <tem:Stream>cid:1235208661655</tem:Stream>
      </tem:UlozitDokumentStreamPozadavek>
   </soapenv:Body>
</soapenv:Envelope>

mike S Accepted Answer Pending Moderation
  1. Friday, 16 June 2023 20:51 PM UTC
  2. PowerBuilder
  3. # 1

use HttpCLient in PB

with 100MB+ file you probably want to send it as a set of blocks, but that depends on what your webservice supports.

 

 

Comment
  1. mike S
  2. Thursday, 29 June 2023 18:48 PM UTC
in addition to this, you should look into using PB shared objects (multi-threading) to do the transfer, so the user isn't blocked while the transfer occurs
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 16 June 2023 09:20 AM UTC
  2. PowerBuilder
  3. # 2

I would suggest to keep using C#.

Write a C# DLL that you can import into powerbuilder NVO using the DLL importer tool.

I think for big files, anything web based would be slow.

just my 2 cts.

Miguel

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.