1 Reply Latest reply on Jun 5, 2014 1:16 PM by asoldano

    Application migration from Tomcat to WildFly 8 - CXF

    just4f

      Hello,

       

      Recently I have started application migration from Tomcat to WildFly. Main reason of doing that was having distributed transactions, including WS-AT.

      Web Services is built on Apache CXF. But I failed to deploy such application on WildFly mainly due to not found classes during deployment like org.apache.cxf.jaxws.JaxWsProxyFactoryBean, org.apache.cxf.interceptor.LoggingInInterceptor, etc. Shouldn't they be included as WildFly module?

       

      What would be correct way to define Web Services and client usage of them, without loss of current logging, SOAP Header credential population functionality, also to include atomic cross web service transactions?

      Current service endpoint configuration:

       

      <bean id="SAAJInInterceptor" class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor" />
      <bean id="serverPasswordCallback" class="my.service.proxies.JaxAuthWsProxyPassCallback">
          <property name="password" value="${auth.manager.password}"></property>
      </bean>
      <bean id="WSS4JInInterceptor" class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
          <constructor-arg>
              <map>
                  <entry key="action" value="UsernameToken" />
                  <entry key="passwordType" value="PasswordText" />
                  <entry key="passwordCallbackRef">
                      <ref bean="serverPasswordCallback"/>
                  </entry>
              </map>
          </constructor-arg>
      </bean>
      
      <jaxws:endpoint implementor="#MyService" address="/MyService">
          <jaxws:inInterceptors>
              <ref bean="SAAJInInterceptor" />
              <ref bean="WSS4JInInterceptor" />
          </jaxws:inInterceptors>
      </jaxws:endpoint>
      
      <bean id="abstractLoggingInterceptor" class="org.apache.cxf.interceptor.AbstractLoggingInterceptor" abstract="true" />
      <bean id="loggingInInterceptor" class="org.apache.cxf.interceptor.LoggingInInterceptor" parent="abstractLoggingInterceptor" />
      <bean id="loggingOutInterceptor" class="org.apache.cxf.interceptor.LoggingOutInterceptor" parent="abstractLoggingInterceptor" />
      
      <cxf:bus>
          <cxf:inInterceptors>
              <ref bean="loggingInInterceptor" />
          </cxf:inInterceptors>
          <cxf:outInterceptors>
              <ref bean="loggingOutInterceptor" />
          </cxf:outInterceptors>
          <cxf:outFaultInterceptors>
              <ref bean="loggingOutInterceptor" />
          </cxf:outFaultInterceptors>
          <cxf:inFaultInterceptors>
              <ref bean="loggingInInterceptor" />
          </cxf:inFaultInterceptors>
      
      </cxf:bus>
      
      

       

      Current Client endpoint configuration:

       

      <bean id="MyServiceProxyFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
          <qualifier value="MyService"></qualifier>
          <property name="serviceClass" value="my.interfaces.IMyService" />
          <property name="address" value="${service.MyServiceEndpoint}" />
          <property name="inInterceptors">
              <list>
                  <ref bean="logIn" />
              </list>
          </property>
          <property name="outInterceptors">
              <list>
                  <ref bean="logOut" />
                  <ref bean="saajOut" />
                  <ref bean="wss4jOut" />
              </list>
          </property>
      </bean>
      
      <bean id="logIn" class="org.apache.cxf.interceptor.LoggingInInterceptor" />
      <bean id="logOut" class="org.apache.cxf.interceptor.LoggingOutInterceptor" />
      <bean id="saajOut" class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor" />
      <bean id="clientPasswordCallback" class="my.service.proxies.JaxAuthWsProxyPassCallback">
          <property name="password" value="${auth.client.password}"></property>
      </bean>
      <bean id="wss4jOut" class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
          <constructor-arg>
              <map>
                  <entry key="action" value="UsernameToken" />
                  <entry key="user" value="username" />
                  <entry key="passwordType" value="PasswordText" />
                  <entry key="passwordCallbackRef">
                      <ref bean="clientPasswordCallback"/>
                  </entry>
              </map>
          </constructor-arg>
      </bean>
      

       

      Thanks,

      Justas

        • 1. Re: Application migration from Tomcat to WildFly 8 - CXF
          asoldano

          Justas,

          unfortunately you can't expect your application to work seamlessly as-is when migrating from Tomcat to WildFly.

          As a general suggestion, I invite you to read Webservices reference guide - WildFly 8 - Project Documentation Editor and in particular https://docs.jboss.org/author/display/WFLY8/Apache+CXF+integration.

          If you were to keep your application as-is and accept loosing any advantages you get by running on a full JavaEE container, you could add a proper jboss-deployment-structure.xml descriptor to your deployment to tell the container to disable the webservices subsystem, hence making WildFly look like a glorified web container (~ Tomcat) to your app. But I understand you want to eventually use webservices distribute transactions, so you should look at properly modifying your deployment (either drop the Spring configuration approach or move to using the jbossws-cxf.xml descriptor, set proper jboss module dependencies, etc. - as explained in the documentation).