|
Page Edited :
CXF20DOC :
JAX-WS Configuration
JAX-WS Configuration has been edited by Chris Moesel (Apr 17, 2007). Content:Please see the Configuration section to learn how to supply a configuration to CXF. The following sections just include the JAX-WS specific configuration information. Configuring an EndpointA 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: <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/schema/jaxws.xsd"> <jaxws:endpoint id="helloWorld" implementor="demo.spring.HelloWorldImpl" address="http://localhost/HelloWorld" /> </beans>
It also supports many child elements:
Here is a more advanced example which shows how to provide interceptors and properties: <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/schema/jaxws.xsd"> <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"/> </beans> If you are a Spring user, you'll notice that the <jaxws:properties> element follows the Spring Map syntax. Configuring a Client Proxy
To build a Client using Spring, you'll need to declare a proxy factory bean and also a client bean which is created by that proxy factory. Here is an example: <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/schema/jaxws.xsd"> <bean id="proxyFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean"> <property name="serviceClass" value="demo.spring.HelloWorld"/> <property name="address" value="http://localhost:9002/HelloWorld"/> </bean> <bean id="client" class="demo.spring.HelloWorld" factory-bean="proxyFactory" factory-method="create"/> </beans> The JaxWsProxyFactoryBean in this case takes two properties. The service class, which is the interface of the Client proxy you wish to create. The address is the address of the service you wish to call. The second bean definition is for the client. In this case it implements the HelloWorld interface and is created by the proxyFactory <bean> by calling the create() method. You can then reference this "client" bean and inject it anywhere into your application. The ProxyFactoryBean supports many other properties:
|
Unsubscribe or edit your notifications preferences
