JBoss Community

JBossWS/CXF configuration / extensions

created by Robert Stupp in JBoss AS 7 Development - View the full discussion

Hi,

 

I am currently working on a project, where we need to add custom CXF interceptors to the CXF bus for the current deployment.

 

The only practically working way to customize the deployment is to add a WEB-INF/jbossws-cxf.xml file to our deployment.

Generally it works, but there are some bad things using the combination AS7/JBossWS/CXF.

 

We have a lot of web services which are bundled in one or more WAR files.

All of them have "standard" JAX-WS annotations (e.g. @WebService) and work fine (everything bundled in a WAR in an EAR ; deploy to AS7 ; fine).

 

But as I mentioned, we need custom interceptors.

 

So I added the interceptors to a jbossws-cxf.xml file:

    <jaxws:endpoint

            address='http://@jboss.bind.address@/demo/service/SuperService'

            implementor='com.mycompany.demo.java.MySuperWebservice'>

       <jaxws:inInterceptors>

            <ref bean="myGreatInterceptor"/>

        <jaxws:inInterceptors>

    </jaxws:endpoint>

 

This works - but what I really want is a default bus configuration for all webservices in the WAR file (deployment) - I do not want to configure all web services. So I tried the following approach in jbossws-cxf.xml:

    <bean class="com.mycompany.jboss7.cxf.BusInterceptorsInjector" init-method="injectInterceptors">

        <property name="bus" ref="cxf"/>

        <property name="inInterceptors">

            <list>

                <ref bean="FrameworkCxfPreInvokeInterceptor"/>

                <ref bean="FrameworkCxfPostInvokeInterceptor"/>

            </list>

        </property>

    </bean>

This works - but only if every webservice is mentioned like

    <jaxws:endpoint

            address='http://@jboss.bind.address@/demo/service/SuperService'

            implementor='com.mycompany.demo.java.MySuperWebservice'/>

This is silly, because the jaxws:endpoint configuration specifies nothing meaningful.

Every invocation of a web service which is not mentioned in a jbossws-cxf.xml file, fails with a NullPointerException in org.jboss.wsf.stack.cxf.CXFInstanceProvider at line 57 - the CXFInstanceProvider is configured with a "null" ServerFactoryBean.

 

What I would like to have in AS7/JBossWS/CXF is

  • a mechanism, where I can configure the CXF bus for each deployment (specifying another bus definition in jbossws-cxf.xml does not work, because the "default" bus is created "inside the server code") and
  • no need to specify every web service in jbossws-cxf.xml and
  • no need to specify the fully qualified address attribute in jaxws:endpoint - developers do not know the exact address, port and context path ot a deployment. AS7/JBossWS should accept at least paths relative to the context root of the current deployment (specifying addresses like /service/SuperService does not work - it cannot find the destination of a web service call)
  • no need to specify the implementor in jaxws:endpoint, because it is already configured elsewhere (web.xml) - a functionaltity like a "servlet-link" would be great

 

Robert.

Reply to this message by going to Community

Start a new discussion in JBoss AS 7 Development at Community