<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mersoft Corporation Blog &#187; client-config.wsdd</title>
	<atom:link href="http://blog.mersoft.com/tag/client-config-wsdd/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mersoft.com</link>
	<description>Achieve, Compete, and Evolve</description>
	<lastBuildDate>Wed, 07 Sep 2011 15:13:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to Configure Axis 1.4 WS Client (Java) to accept GZIP compressed SOAP messages.</title>
		<link>http://blog.mersoft.com/2009/08/27/how-to-configure-axis-1-4-ws-client-java-to-accept-gzip-compressed-soap-messages/</link>
		<comments>http://blog.mersoft.com/2009/08/27/how-to-configure-axis-1-4-ws-client-java-to-accept-gzip-compressed-soap-messages/#comments</comments>
		<pubDate>Thu, 27 Aug 2009 18:32:14 +0000</pubDate>
		<dc:creator>Peter Tarlos</dc:creator>
				<category><![CDATA[Information Technology]]></category>
		<category><![CDATA[Java/Java Frameworks]]></category>
		<category><![CDATA[1.4]]></category>
		<category><![CDATA[1.x]]></category>
		<category><![CDATA[axis]]></category>
		<category><![CDATA[client-config.wsdd]]></category>
		<category><![CDATA[compression]]></category>
		<category><![CDATA[gzip]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[soap]]></category>
		<category><![CDATA[web service]]></category>

		<guid isPermaLink="false">http://blog.mersoft.com/?p=281</guid>
		<description><![CDATA[In this blog I will explain how to write an Axis 1.4 Client that can accept GZIP compressed SOAP messages.  The GZIP compression feature of Axis 1.x is not well documented on the Apache website, so you have to search for it in blogs like this one.  You can also use Axis 1.x [...]]]></description>
			<content:encoded><![CDATA[<p>In this blog I will explain how to write an Axis 1.4 Client that can accept GZIP compressed SOAP messages.  The GZIP compression feature of Axis 1.x is not well documented on the Apache website, so you have to search for it in blogs like this one.  You can also use Axis 1.x to write server side code to  compress SOAP messages, but I will not cover that in this blog.</p>
<p>Steps to write Axis 1.4 Client code:</p>
<ol>
<li> Create the Axis Client code: Run wsdl2java on your wsdl to generate the client side stubs.  Write code to connect to the correct web service endpoint.  You can find examples on the Axis website and numerous blogs.</li>
<li>Use a TCP/IP monitoring software so that you can see the request and response messages.  If you&#8217;re using Eclipse, there&#8217;s already a built-in “TCP/IP Monitor”.  The monitor will tunnel a TCP connection from a local port to the web service endpoint.  Set the Monitor Type to TCP/IP and not HTTP.</li>
<li>Test that you can get to the web service using the TCP/IP monitor. (Compression in not enabled at this point)</li>
<li>Add an HTTP Header to the request to inform the server that the client accepts GZIP compression.  (HTTP Header is not to be confused with the SOAP Header).</li>
<div style="text-align:left;color:#000000;background-color:#ffffff;border:solid black 1px;padding:0.5em 1em 0.5em 1em;overflow:auto;font-size:medium;font-family:monospace">URL url = new URL(&#8221;www.acme.corp/webservice/MyService&#8221;);<br />
AcmeServiceLocator service = new AcmeServiceLocator();<br />
AcmeServicePortType port = service.getacmeServiceHttpPort(url);<br />
<strong>((Stub) port)._setProperty(HTTPConstants.MC_ACCEPT_GZIP,Boolean.TRUE);</strong><br />
QueryResult result = port.queryMyStore(param);</div>
<li>Change the Axis Client configuration file to use &#8220;CommonsHTTPSender&#8221; instead of the default &#8220;HTTPSender&#8221; as the http transport.  This transport knows how to deal with GZIP compression, the default one does not. The Axis configuration file can be found in the Axis.jar (client-config.wsdd).  This file needs to be modified to use &#8220;CommonsHTTPSender&#8221;, see below. (I tested this configuration with Axis 1.4; older versions might have a slightly different configuration)  The updated client-config.wsdd file needs to be put on the Classpath.</li>
<div style="text-align:left;color:#000000;background-color:#ffffff;border:solid black 1px;padding:0.5em 1em 0.5em 1em;overflow:auto;font-size:medium;font-family:monospace">&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;<br />
&lt;deployment name=&#8221;defaultClientConfig&#8221;<br />
xmlns=&#8221;http://xml.apache.org/axis/wsdd/&#8221;<br />
xmlns:java=&#8221;http://xml.apache.org/axis/wsdd/providers/java&#8221;&gt;<br />
&lt;globalConfiguration&gt;<br />
&lt;parameter name=&#8221;disablePrettyXML&#8221; value=&#8221;true&#8221;/&gt;<br />
&lt;parameter name=&#8221;enableNamespacePrefixOptimization&#8221; value=&#8221;false&#8221;/&gt;<br />
&lt;/globalConfiguration&gt;<br />
<strong>&lt;transport name=&#8221;http&#8221; pivot=&#8221;java:org.apache.axis.transport.http.CommonsHTTPSender&#8221;/&gt;</strong><br />
<del>&lt;transport name=&#8221;http&#8221; pivot=&#8221;java:org.apache.axis.transport.http.HTTPSender&#8221;/&gt;</del><br />
&lt;transport name=&#8221;local&#8221; pivot=&#8221;java:org.apache.axis.transport.local.LocalSender&#8221;/&gt;<br />
&lt;transport name=&#8221;java&#8221; pivot=&#8221;java:org.apache.axis.transport.java.JavaSender&#8221;/&gt;<br />
&lt;/deployment&gt;</div>
<li>Now run your code!  In the TCP/IP monitor you should see the HTTP Header “Accept-Encoding: gzip” in the request.  In the response you should see the HTTP Header “Content-encoding: gzip” and some binary data on the bottom.  This is the server telling the client that it is sending back GZIP-ed data.</li>
<div style="text-align:left;color:#000000;background-color:#ffffff;border:solid black 1px;padding:0.5em 1em 0.5em 1em;overflow:auto;font-size:medium;font-family:monospace"><strong>*** Request Message ***</strong><br />
POST /webservice/MyService HTTP/1.1<br />
Content-Type: text/xml; charset=utf-8<br />
SOAPAction: &#8220;&#8221;<br />
User-Agent: Axis/1.4<br />
<strong>Accept-Encoding: gzip</strong><br />
Host: localhost:9001<br />
Transfer-Encoding: chunked<br />
28a<br />
&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;&lt;soapenv:Envelope &#8230;</p>
<p><strong>*** Response Message ***</strong><br />
Server: Sun-ONE-Web-Server/6.1<br />
Date: Thu, 27 Aug 2009 15:42:25 GMT<br />
Content-type: text/xml;charset=UTF-8<br />
X-powered-by: Servlet 2.4; JBoss-4.0.5.GA Tomcat-5.5<br />
<strong>Content-encoding: gzip</strong><br />
Vary: Accept-Encoding<br />
Transfer-encoding: chunked<br />
479</div>
</ol>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fblog.mersoft.com%2F2009%2F08%2F27%2Fhow-to-configure-axis-1-4-ws-client-java-to-accept-gzip-compressed-soap-messages%2F&amp;linkname=How%20to%20Configure%20Axis%201.4%20WS%20Client%20%28Java%29%20to%20accept%20GZIP%20compressed%20SOAP%20messages."><img src="http://blog.mersoft.com/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://blog.mersoft.com/2009/08/27/how-to-configure-axis-1-4-ws-client-java-to-accept-gzip-compressed-soap-messages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

