0 Replies Latest reply on Feb 28, 2008 8:39 AM by kokot-san

    Compress XML request before seding with HTTPService

    kokot-san Level 1

      I was wondering how I can compress an XML-request before sending it to the server and let Apache2 decompress it before sending it to the target application. For this, in Apache2 I enabled the module "deflate" with the following configuration:

      <IfModule mod_deflate.c>
      AddOutputFilterByType DEFLATE text/xml application/xml
      SetInputFilter DEFLATE

      Note that the output filter works fine, but I also want to compress XML in Flex 3/AS before sending it to the server. What I did so far - without success - is:

      var service:HTTPService = new HTTPService();
      service.method = "POST";
      service.url = ...;
      service.contentType = "application/xml";
      service.headers["Content-Encoding"] = "gzip";
      var xmlRequest:String = ...;
      var bytes:ByteArray = new ByteArray();
      service.request = bytes.readUTF8();

      Then Apache2 gives the following error:
      (20014)Internal error: Error reading request entity data, referer: file:///C:/Documents and Settings/Andrej/My Documents/Flex Builder 3/gui/bin/MBraceGUI.swf

      Does anybody know how to make this work? What am I doing wrong?