cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <>
Subject Re: Bindings and Transports programmatic configuration
Date Thu, 23 Sep 2010 14:21:04 GMT
On Tuesday 21 September 2010 1:46:28 am Milisic Aleksandar wrote:
> Hi,
> I'm interested in how to configure the bindings and transport for a service
> endpoint using the JaxWs Api.
> I am using the JaxWsServerFactoryBean to publish a service. I see two
> methods that I believe are of interest - setBindingId(String bindingId)
> and setTransportId(String transportId).
> Unfortunately, the parameters are just strings so they don't tell me much
> about this at all.
> From my research so far, I have found the following:
> Say I have the following common code:
> JaxWsServerFactoryBean serverFactory = new JaxWsServerFactoryBean();
> serverFactory.setServiceClass(someServiceClass.getClass());
> serverFactory.setAddress(someddress);
> The differences for the various bindings/transports would be:
> 1. Using SOAP 1.1
>  Would remain intact, no changes needed? Is this right?
> 2. Using SOAP1.2
> //add line
> serverFactory.setBindingId(SOAPBinding.SOAP12HTTP_BINDING);
> 3. Using Pure XML
> //add line
> serverFactory.setBindingId(XmlConstants.NS_XML_FORMAT);
> 4. Using SOAP/JMS
> //add line
> serverFactory.setTransportId(JMSSpecConstants.SOAP_JMS_SPECIFICIATION_TRANS
> 5. Using CORBA
> //not sure?
> I was hoping somebody could confirm what I have found in 1-5 and also help
> me fill in the gaps.

Well, there are a bunch of other options for those as well.  The best place to 
look is actually the **Factory things  (like SOAPTransportFactory, 
SOAPBindingFactory, CORBABindingFactory, etc...)  OR the META-INF/cxf/cxf-
extension-****.xml files.    They have defined namespaces that can be used.  
For example, for (5), the cxf-extension-corba.xml file defines:


and either of them can be used.  (the latter is historical as the CORBA 
binding originated from the Yoko project)  Also note: for the CORBA case, the 
binding and transport ID's would be the same as CORBA is both the binding and 
the transport.

> Another question was, in case of SoapBinding, I also would like to be able
> to configure other parameters using the API at the time of publishing
> (i.e. not with annotations).
> These are:
> 1. The ParameterStyle, i.e. BARE or WRAPPED
> 2. Use, i.e. ENCODED or LITERAL and
> 3. Style, i.e RPC or DOCUMENT

Well, #2 is not likely possible.   CXF doesn't support ENCODED at all so we 
PROBABLY have places where LITERAL is just hard coded.

For 1 and 3, you would need to create your own subclass of 
and override whatever methods you want to control.   Then configure that into 
the ServiceFactoryBean in the JaxWsServerFactoryBean at the beginning of the 
ServiceConfiguration list.  Basically, the ReflectionServiceFactoryBean uses 
the list of ServiceConfiguration to retrieve pretty much all the information 
it needs.  JAX-WS has a subclass that gets that information from Annotations, 
but you can easily create your own that gets that information from elsewhere.

Daniel Kulp

View raw message