Return-Path: Delivered-To: apmail-ws-soap-user-archive@www.apache.org Received: (qmail 43000 invoked from network); 15 Sep 2004 13:11:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 15 Sep 2004 13:11:22 -0000 Received: (qmail 5333 invoked by uid 500); 15 Sep 2004 13:11:15 -0000 Delivered-To: apmail-ws-soap-user-archive@ws.apache.org Received: (qmail 5246 invoked by uid 500); 15 Sep 2004 13:11:15 -0000 Mailing-List: contact soap-user-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: soap-user@ws.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list soap-user@ws.apache.org Received: (qmail 5235 invoked by uid 99); 15 Sep 2004 13:11:15 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from [216.148.227.85] (HELO rwcrmhc12.comcast.net) (216.148.227.85) by apache.org (qpsmtpd/0.28) with ESMTP; Wed, 15 Sep 2004 06:11:14 -0700 Received: from northgate (pcp01349753pcs.lowmrn01.pa.comcast.net[68.80.227.95]) by comcast.net (rwcrmhc12) with SMTP id <200409151311120140086b7le> (Authid: scottnichol); Wed, 15 Sep 2004 13:11:13 +0000 Message-ID: <1c7f01c49b25$ef3464a0$6401a8c0@northgate> From: "Scott Nichol" To: References: <00b801c49996$1c660a50$72aafe96@polygonatum> Subject: Re: Compressing response Date: Wed, 15 Sep 2004 09:14:28 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N The line of code resCtx =3D new SOAPContext(); // get rid of old one from RPCRouterServlet, only runs when an exception is thrown. The code that runs is something like this RPCRouterServlet: provider.locate( dd, callEnv, call, call.getMethodName(), = fullTargetID,=20 reqCtx ); ServerUtils.setResponseGzip(dd, reqCtx, resCtx); ServerUtils: if (Boolean.TRUE.equals(reqCtx.getAcceptGzip())) { // Request specified gzip OK Hashtable props =3D dd.getProps(); String gzip =3D props !=3D null ? (String) props.get("gzip") : = null; resCtx.setGzip(gzip !=3D null && = SoapEncUtils.decodeBooleanValue(gzip)); } else if (Boolean.FALSE.equals(reqCtx.getAcceptGzip())) { // Request specified gzip not OK resCtx.setGzip(false); } else { // Request specified nothing, for now do not gzip // TODO: should accept be required? resCtx.setGzip(false); } RPCRouterServlet: provider.invoke( reqCtx, resCtx ); RPCJavaProvider: Response resp =3D RPCRouter.invoke( dd, call, targetObject,=20 reqContext, resContext ); RPCRouter: return new Response (call.getTargetObjectURI (), call.getMethodName = (), ret, null, null, respEncStyle, resCtx); RPCJavaProvider: Envelope env =3D resp.buildEnvelope(); StringWriter sw =3D new StringWriter(1024); env.marshall( sw, call.getSOAPMappingRegistry(), resContext ); resContext.setRootPart( sw.toString(), = Constants.HEADERVAL_CONTENT_TYPE_UTF8); RPCRouterServlet: // Generate response. TransportMessage sres =3D new TransportMessage(null, resCtx, null = ); sres.editOutgoing(editor); // Generate response byte array. sres.save(); TransportMessage: if (Boolean.TRUE.equals(ctx.getGzip())) { // Deflate ByteArrayOutputStream baos =3D new ByteArrayOutputStream(bytes.length); GZIPOutputStream gzos =3D new GZIPOutputStream(baos); gzos.write(bytes, offset, bytes.length - offset); gzos.close(); baos.close(); bytes =3D baos.toByteArray(); offset =3D 0; headers.put(Constants.HEADER_CONTENT_ENCODING, = Constants.HEADERVAL_CONTENT_ENCODING); } RPCRouterServlet: // Write. res.setStatus(status); res.setContentType(sres.getContentType()); for (Enumeration headers =3D sres.getHeaderNames(); headers.hasMoreElements(); ) { String name =3D (String)headers.nextElement(); res.setHeader(name, sres.getHeader(name)); } res.setContentLength(sres.getContentLength()); OutputStream outStream =3D res.getOutputStream(); sres.writeTo(outStream); In order to have your service gzip the result, the client must specify = that it accepts gzip, and the deployment descriptor must have the option = set to allow gzip. Remember that when you change the deployment = descriptor, you must re-deploy the service. Scott Nichol Do not send e-mail directly to this e-mail address, because it is filtered to accept only mail from specific mail lists. ----- Original Message -----=20 From: "Micha=B3 Ma=B3ecki" To: Sent: Monday, September 13, 2004 9:32 AM Subject: Compressing response > Hello, > I'm trying to compress SOAP messages (second day). The SOAP from = client to > server was archived with no problems. However, soap from server to = client is > still plain-text. I have added option "gzip", I have disabled Norton > firewall (killed accepted-encoding header). I searched the source code > (ws-soap_20040912104811) and I can't find out how ever the compression = could > be archived - the outputStream is gzipped if SOAPSontext.getGzip = return > true, but TransportMessage is created like this: > new TransportMessage(null, resCtx, null ); > and resCtx is created few lines before: > resCtx =3D new SOAPContext(); // get rid of old one > so where the gzip of soapcontext could be set? >=20 > I beg you - please tell me how to archive this?? > Micha=B3 Ma=B3ecki >=20 >=20 >