• Post Reply Bookmark Topic Watch Topic
  • New Topic

GZip in Axis

 
Jobin Mathew
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do anyone knows Gzip compression in Axis.
I want to send xml's in zipped format and I need to accept gzip format message and convert in into normal uncompressed soap messages. Do anyone had idea about doing this?
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Axis is implemented as a servlet, so a compression filter like the one linked here might work.
 
Jobin Mathew
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think filters cannot do much on soap requets and responses.
Do any one had a peice of code specially written for Gzip in Axis.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think filters cannot do much on soap requets and responses.


Why not? Do you need to transport zipped SOAP over an unzipped HTTP request?
 
Jobin Mathew
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to Zip the soap message which I am sending.
Also if I send Zipped message server also gives response which is zipped. So I want to unzip that. Can you have any code for doing these in Axis?
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to zip just the SOAP (and not the whole HTTP), then it's getting more complicated, and I don't know of an easy solution for this. Instead of gzipping all of the SOAP, I would advise to compress the payload elements, and encode those with base-64 so that they can be sent over the wire.

What are trying to achieve - is the SOAP content so lengthy that gzipping it makes a performance difference? Are you certain that the overhead of zipping/unzipping won't negate the benefits of having to send fewer bytes?
 
Jose Mon
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some times my response xml contains 10,000 to 20,000 lines. So I think it is best to accept compressed response.
I got the compressed response in ResponseHandler. ie I had the full soap envelope. Now how can I decompress that and set the decompressed message to the same same context?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry but I cant really follow this.

Is the body of the response zipped but not the SOAP headers? In that case the zipped body must be base64 encoded because the binary zip would contain characters illegal in XML. You would have to decode to create an input stream for the parser.

The clearest thing to do is zip/unzip all input and output messages completely like Ulf said. I dont think you need axis specific code since Java standard library contains the java.util.zip package.

I found that due to the repetitive nature of xml, zipping can compress by more than a factor of 10 and that unzipping only increases parsing time by a small amount.

Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!