2 Replies Latest reply on Dec 18, 2008 11:09 AM by valnub

    Filetransfer via Webservice

    valnub
      Hello, everyone.

      I am trying to write a client with Flex/AIR that can download files using a webservice (wsdl).

      The webservice method returns me a byteArray.

      The whole thing is working and the datatransfer is pretty fast, but the decoding of the byteArray seems to be so slow, that it freezes the whole application during that procedure.

      With smaller files, the short freeze does not bother at all. But with files bigget than, let's say, 5mb the period of waiting becomes very very long.

      Does anyone know a solution for that problem?

      Here is the actionscript code I use on the client side (Unlike the code is saying, I am not using MTOM here (Since FLEX doesn't support MTOM at all, as far as I know). It was intended to use it, but since there is no implementation, we simply turned it off on the server):




      public function init():void{
      var service:Service = new Service();
      service.addgetTestMTOMEventListener(testfunc);
      // App starts freezing HERE
      service.getTestMTOM();
      }

      public function testfunc(evt:GetTestMTOMResultEvent):void{
      var arr:ByteArray = evt.result.testDataHandler;

      var dir:File = File.desktopDirectory.resolvePath("files");
      dir.createDirectory();

      var file:File = File.desktopDirectory.resolvePath("files/testfile.zip");

      var fileStream:FileStream = new FileStream();
      fileStream.open(file, FileMode.WRITE);
      fileStream.writeBytes(arr);

      fileStream.close();
      }