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

    Application migration from Tomcat to WildFly 8 - CXF

    Justas D Newbie

      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