Skip to main content

Configure the JAXWS Server/Client Using Spring

CXF provides <jaxws:server>, <jaxws:client> to configure the server/client side endpoint. Here are some exmples:

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:jaxws="http://cxf.apache.org/jaxws"
   xmlns:soap="http://cxf.apache.org/bindings/soap"
   xsi:schemaLocation="
      http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
      http://cxf.apache.org/bindings/soap 
      http://cxf.apache.org/schemas/configuration/soap.xsd
      http://cxf.apache.org/jaxws
      http://cxf.apache.org/schemas/jaxws.xsd">

   <jaxws:server id="inlineImplementor" 
      address="http://localhost:8080/simpleWithAddress">
      <jaxws:serviceBean>
         <bean class="org.apache.hello_world_soap_http.GreeterImpl"/>
      </jaxws:serviceBean>
   </jaxws:server>

   <jaxws:server id="bookServer"
      serviceClass="org.myorg.mytype.AnonymousComplexTypeImpl"
      address="http://localhost:8080/act"
      bus="cxf">
      <jaxws:invoker>
         <bean class="org.myorg.service.invoker.BeanInvoker">
            <constructor-arg>
               <bean class="org.myorg.mytype.AnonymousComplexTypeImpl"/>
            </constructor-arg>
         </bean>
      </jaxws:invoker>
      <jaxws:dataBinding>
         <bean class="org.apache.cxf.jaxb.JAXBDataBinding">
            <property name="namespaceMap">
               <map>
                  <entry>
                     <key>
                        <value>
                           http://cxf.apache.org/anon_complex_type/
                        </value>
                     </key>
                     <value>BeepBeep</value>
                  </entry>
               </map>
            </property>
         </bean>
      </jaxws:dataBinding>
   </jaxws:server>

   <jaxws:client id="bookClient"
      serviceClass="org.myorg.mytype.AnonymousComplexType"
      address="http://localhost:8080/act"/>

</beans>

Since JAX-WS frontend server and client spring configuration parser are inherited from the simple frontend, please see Simple Frontend Configuration for the attribute and element definitions.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!