Enabling gzip Compression with SOAP4R
It's a one-liner, but info isn't easy to find (as usual with soap4r).
When you generate your local driver with for example
wsdl2ruby.rb --wsdl MyService.wsdl --classdef MyService --type client --force
and you instantiate your proxy driver like so
ms = MyService.new
ms.wiredump_dev = STDERR
you simply add
ms.streamhandler.accept_encoding_gzip = true
That's all. No need for custom headers etc.
And: zlib (compression library used by soap4r) is built into Ruby since version 1.8. No need for any gems or other shenenigans.
As an added year-end bonus, here's a list of links that helped me with SOAP and ruby over the years:
Excellent SAP article:
Correct usage of wsdl2ruby (must be wsdl2ruby.rb)
ActionWebService:
http://www.datanoise.com/articles/2008/7/2/actionwebservice-is-back
Links:
http://www.brendonwilson.com/blog/2006/04/02/ruby-soap4r-wsdl-hell/
WSDL/Ruby:
Very Helpful Detailed Article:
http://www.ibm.com/developerworks/opensource/library/os-ws-rubyrails/index.html
xsltproc examples:
http://linux.byexamples.com/archives/463/xslt-processor-command-line/
xsd2wsdl:
http://jira.springframework.org/secure/attachment/12306/XsdToWsdl.xsl
linked from here:
http://jira.springframework.org/browse/SWS-79
Don’t forget to enable wiredump:
fe.wiredump_dev = STDERR
Get rid of NS1:
http://www.pluitsolutions.com/2007/08/10/remove-n1-namespace-for-soap4r/
Posted: 30 December 2010