Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

A JAX-WS Endpoint can be configured in XML in addition to using the JAX-WS APIs. Once you've created your server implementation, you simply need to provide the class name and an address. Here is a simple example:

Code Block
javaxmljava
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"
	xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">

<jaxws:endpoint id="classImpl"
    implementor="org.apache.cxf.jaxws.service.Hello"
    endpointName="e:HelloEndpointCustomized"
    serviceName="s:HelloServiceCustomized"
    address="http://localhost:8080/test"
    xmlns:e="http://service.jaxws.cxf.apache.org/endpoint"
    xmlns:s="http://service.jaxws.cxf.apache.org/service"/>

</beans>

...

Here is a more advanced example which shows how to provide interceptors and properties:

Code Block
javaxmljava
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">

  <import resource="classpath:META-INF/cxf/cxf.xml"/>
  <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>

  <jaxws:endpoint
    id="helloWorld"
    implementor="demo.spring.HelloWorldImpl"
    address="http://localhost/HelloWorld">
    <jaxws:inInterceptors>
      <bean class="com.acme.SomeInterceptor"/>
      <ref bean="anotherInterceptor"/>
    </jaxws:inInterceptor>
    <jaxws:properties>
      <entry key="mtom-enabled" value="true"/>
    </jaxws:properties>
  </jaxws:endpoint>

  <bean id="anotherInterceptor" class="com.acme.SomeInterceptor"/>

  <jaxws:endpoint id="simpleWithBinding"
    implementor="#greeter" address="http://localhost:8080/simpleWithAddress">
  	<jaxws:binding>
  	   <soap:soapBinding mtomEnabled="true" version="1.2"/>
  	</jaxws:binding>
  </jaxws:endpoint>

  <jaxws:endpoint id="inlineInvoker" address="http://localhost:8080/simpleWithAddress">
    <jaxws:implementor>
      <bean class="org.apache.hello_world_soap_http.GreeterImpl"/>
    </jaxws:implementor>
    <jaxws:invoker>
      <bean class="org.apache.cxf.jaxws.spring.NullInvoker"/>
    </jaxws:invoker>
  </jaxws:endpoint>

</beans>

...