1 Reply Latest reply on Nov 18, 2010 9:56 AM by Heiner Lamprecht

    How to enable compression for clients?

    Heiner Lamprecht Newbie



      I'm currently developing a simple session bean for JBoss 5.1, which acts as a web service client.  I would like to enable gzip compression, but it doesn't seam to work.  The code is:


          BindingProvider portBindingProvider = (BindingProvider) port;

          Object headers = portBindingProvider.getRequestContext().get(MessageContext.HTTP_REQUEST_HEADERS);
          Map<String, List<String>> httpHeaders = new HashMap<String, List<String>>();
          httpHeaders.put("Accept-Encoding", Collections.singletonList("gzip"));
          Map<String, Object> ctxt = portBindingProvider.getRequestContext();
          ctxt.put(MessageContext.HTTP_REQUEST_HEADERS, httpHeaders);



      But the HTTP-headers sent by the request still do not contain the "Accept-Encoding" line.  In fact, whatever I add to the headers does not appear in the real request.


      Is there any way to enable compression for client-calls?  The web service I'm calling will return quite a large list, so compressing would help a lot.