Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added <jaxws:server> and <jaxws:client> samples

...

Code Block
java
java
javax.xml.ws.Endpoint jaxwsEndpoint = javax.xml.ws.Endpoint.publish("http://localhost:9020/SoapContext/GreeterPort", new GreeterImpl());
org.apache.cxf.jaxws.EndpointImpl jaxwsEndpointImpl = (org.apache.cxf.jaxws.EndpointImpl)jaxwsEndpoint;
org.apache.cxf.endpoint.Server server = jaxwsEndpointImpl.getServer();
org.apache.cxf.endpoint.Endpoint cxfEndpoint = server.getEndpoint();
cxfEndpoint.getOutInterceptors().add(...);
org.apache.cxf.service.Service cxfService = cxfEndpoint.getService();
cxfService.getOutInterceptors().add(...);

Configure the JAXWS Server/Client Using Spring

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

Code Block
xml
xml

<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.apache.cxf.anonymous_complex_type.AnonymousComplexTypeImpl"
    address="http://localhost:8080/act" 
    bus="cxf">
    <jaxws:invoker>
      <bean class="org.apache.cxf.service.invoker.BeanInvoker">
        <constructor-arg>
          <bean class="org.apache.cxf.anonymous_complex_type.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/anonymous_complex_type/</value></key>
      			<value>BeepBeep</value>
   			</entry>
      		</map>
        </property>
      </bean>
      </jaxws:dataBinding>
  </jaxws:server>

  <jaxws:client id="bookClient" 
    serviceClass="org.apache.cxf.anonymous_complex_type.AnonymousComplexType"
    address="http://localhost:8080/act"/>

</beans>

Since JAXWS frontend server and client spring configuration parser are inherited from simple front,
Please ref Simple Frontend Configuration for the attribute and elements definition.