HTTP compression has improved a lot the download time of content from
servers. In the context of Web Service it could be very interesting to
also use HTTP compression to improve the network traffic. Firs, I am
explaining how to compress a SOAP response when you have a Web Service
running in Oracle Containers for J2EE (OC4J) using a generic servlet
filter. I have to give credit to http://www.thomas-bayer.com/
since he has created the Filter and documented how to do such thing
So you can take a look to the following article for more details, you
can read the 2 following article, or jump to the next paragraph that
explains how to configure your JAX-RPC based service to send compressed
In this sample I am showing how to compress the SOAP response
using a servlet filter, it is also possible to use some other Oracle
infrastructure element to achieve that such as Oracle HTTP
Server/Apache, or Oracle Webcache.
1- Install the compression filter library in your application
Download the compression filter library 2wayfilter-1.2.jar
and copy it into the Web application’sWEB-INF/lib folder
2- Configure your application to use the filter
The configuration of a servlet filter is done using
the web.xml where you reference which servlet or URL will be using the
filter. As you may knowin JAX-RPC, the HTTP endpoint of a service are
exposed as servlet and defined in the web.xml. You can choose to
compress all the endpoint/URL or create a new servlet mapping, that
will become a new SOAP endpoint and only compress this one. If you take
the option of creating a new endpoint keep in mind that it will not be
added to the WSDL automatically, so the client application will have to
point explicitly to the compressed endpoint URL to take benefits of it.
<web-appxmlns="http://java.sun.com/xml/ns/j2ee"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"version="2.4"><servlet><description>Web Service CustomerServiceSoapHttpPort</description><display-name>Web Service CustomerServiceSoapHttpPort</display-name><servlet-name>CustomerServiceSoapHttpPort</servlet-name><servlet-class>demo.oracle.CustomerServiceImpl</servlet-class><load-on-startup>1</load-on-startup></servlet><servlet-mapping><servlet-name>CustomerServiceSoapHttpPort</servlet-name><url-pattern>CustomerServiceSoapHttpPort</url-pattern></servlet-mapping><!-- New servlet mapping to handle compressed SOAP Messages --><servlet-mapping><servlet-name>CustomerServiceSoapHttpPort</servlet-name><url-pattern>CompressedCustomerServiceSoapHttpPort</url-pattern></servlet-mapping><!-- Filter definition with mapping on the compressed endpoint --><filter><filter-name>2WayFilter</filter-name><filter-class>com.osmoticweb.gzipfilter.GZIP2WayFilter</filter-class></filter><filter-mapping><filter-name>2WayFilter</filter-name><url-pattern>CompressedCustomerServiceSoapHttpPort</url-pattern></filter-mapping></web-app>
You can now package and deploy your application.
3- Create & Invoke the service
In this basic configuration you have only changed the servlet that is
the HTTP endpoint of your service. So the compressed endpoint is not
present in the WSDL, but you can use any of the URL to create your
When you have created your proxy, if you want to access the endpoint
that will return the compressed response you must be sure that you are
calling the correct endpoint. You can set the endpoint using the setEndpoint method, of your Web
This is it!
I will in a next post explain how you can using the Oracle Web Service
client API send a compressed request that will have to be uncompressed
on the server using the same filter.
Congratulations to all the Groovy developers, and users that have done a great job with this language that is here in production. And it is interesting to see that more and more projects are using Groovy as part of their infrastructure to simplify development:
Spring 2 integration
… and many development teams in custom projects
So once again happy new year to all… and enjoy it with Groovy !
I was discussing with a friend about SOAP testing tools. We all know SOAP UI that is a very powerful one, but I am also using a very simple one developed on Mac for Mac (cocoa based application), this application is SOAP Client:
As Mac user I sometimes need to use Windows (too often…) or Linux computer, and for this I have been using either my PC or Parallels. Parallels is great but in my daily job my coworker are mainly using VMWare images….
The groovy project gets funding for its development. Big Sky is hiring Jochen
Theodorou one of the Groovy commiter. For the people that do
not know Big Sky. Big Sky is the company behind the the No Fluff Just Stuff symposium tour. Talking about this
symposium, in 2007, Groovy and Grails will have a dedicated track.
The London Groovy and Grails User Group will be holding their next meeting on Wednesday, 6th December 2006 at Skills Matter in London and for the first time ever the meeting will be available via a live web conference, so don’t worry if you are not in London!
Speaking at this month’s meeting will be Graeme Rocher, Grails Project Lead and CTO at Skills Matter. During his talk entitled; Grails Dynamic Tags: Making Tag Libraries Agile, Graeme will discuss Groovy Server Pages and its support for the creation of dynamic tag libraries without the need for configuration.
John Wilson, Groovy Committer, will also be presenting at this meeting. During his talk, entitled; The MetaClass: How Groovy works Under the Hood, John will shed light on the MetaClass so you can better understand its’ function and see how to use it to get your Groovy programs smaller, clearer and faster.
WS-Security provides a way to protect Web Services at the message level (SOAP) and it is
independent of the protocol used (HTTP, JMS, …). However, some services are still using HTTP based authentication for protection. JAX-RPC and its Oracle implementation provides a way to set the username
and password in the client (Stub) using some properties on the Stub.
OracleAS 10gR3, so OC4J standalone, is using the standard Java logging framework. Some of the
benefits are easy configuration, and extensibility. The configuration of the level of logging of the different loggers has been exposes in
the Oracle Application Server Console. To see the logger configuration, click on the Administration Tab and then Logger Configuration, you can then configure the different loggers.
By default the logger will write all the information in the default log.xml file, and for application lever logger it will go in the application.log. You may want to send the information in the console during development to debug/analyze your application. This is done using the configuration of the Handler. This information is currently not available in the Application Server Console, so I am documenting in the next steps how
to send the information in the console (terminal window).
The configuration of the OracleAS Logging is saved in the $ORACLE_HOME/j2ee/home/config/j2ee-logging.xml file. In this file you can see that Oracle has defined
various handlers where information can be sent:
console-handler : Log the information in the console (the one we want to use in this sample)
oc4j-handler : the default handler for most of the loggers, saving the information in the $ORACLE_HOME/j2ee/home/log/oc4j/log.xml using the Oracle Logger formatting
oracle-webservices-management-auditing-handler : the handler used by the Web Services Auditing feature in the $ORACLE_HOME/j2ee/home/log/wsmgmt/auditing/log.xml
oracle-webservices-management-logging-handler : the handler used by the Web Service Logging feature in the $ORACLE_HOME/j2ee/home/log/wsmgmt/logging/log.xml
As you may know, OracleAS Web Service provides out of the box support for Auditing of the SOAP messages. You just need to go in the administration page of the Web Service and enable the auditing. By default the messages are logged in the auditing log pointed above. But during development it is really interesting to see the SOAP Messages in the console without having to configure a Proxy to capture the request/response. The easiest way to do that is to edit the j2ee-logging.xml file and associate the console-handler to the auditing logger using the following configuration: