Red Hat
Apr 18, 2013
by Alessio Soldano
This blog post is about few additions that are coming with JBossWS 4.2 release which I actually started working on due to some specific Narayana requirements, but ended up using for additional tasks too.

Starting from version 2.1, the JAX-WS API contains the javax.xml.ws.WebServiceFeature abstract class which is used to configure clients, e.g. when getting the port stub. The JAX-WS reference impl, which is also included in the JDK, bundles three implementations of WebServiceFeature for controlling addressing, MTOM and wsdl:extension usage.

As of JBossWS 4.2.0.Alpha1, a custom extension of WebServiceFeature is available, org.jboss.ws.api.configuration.AbstractClientFeature. That offers users and project integrators a way of initializing the client BindingProvider, setting handlers, etc. The JBoss project for distributed webservices transactions, Narayana, actually leveraged this addition to really simplify the way users write clients for WS-AT and WS-BA enabled webservices. Two custom features built on top of AbstractClientFeature let Narayama hide all its context propagation configuration from the user eyes ;-)

Now, as most of you probably know, JBossWS also comes with a notion of predefined client-configuration which can be used to prepare JAX-WS client configuration templates to associate client ports to. Configurations can include properties as well as handlers declaration and are provided either as part of the JBoss AS webservices subsystem configuration (standalone.xml / domain.xml) or as a separate file.
The AbstractClientFeature extension above offered a way for also simplifying a client-configuration setup for a given JAX-WS client; the org.jboss.ws.api.configuration.ClientConfigFeature allows specifying the name of the desired client-configuration as well as the file to read that from (null for reading from the AS model):

Nice, isn't it?
Feel free to try this as well as any other additions on JBossWS trunk, the 4.2.0 final release is coming in the next months. Feedback is welcome!