|
Page Edited :
CXF20DOC :
Simple Frontend Configuration
Simple Frontend Configuration has been edited by willem jiang (Mar 02, 2008). Content:Configure with Spring for the simple front end serverYou can configure the CXF simple front end server endpoint by using the <simple:server> tag in the spring. <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:simple="http://cxf.apache.org/simple" 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/simple http://cxf.apache.org/schemas/simple.xsd"> <simple:server id="pojoservice" serviceClass="demo.hw.server.HelloWorld" address="/hello_world"> <simple:serviceBean> <bean class="demo.hw.server.HelloWorldImpl" /> </simple:serviceBean> </simple:server> </beans> The simple:server element supports many additional attributes:
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:simple="http://cxf.apache.org/simple" 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/simple http://cxf.apache.org/schemas/simple.xsd"> <simple:server id="inlineInvoker" serviceClass="org.apache.cxf.service.factory.HelloServiceImpl" address="http://localhost:8080/simpleWithAddress"> <simple:invoker> <bean class="org.apache.cxf.service.invoker.BeanInvoker"> <constructor-arg> <bean class="org.apache.cxf.service.factory.HelloServiceImpl"/> </constructor-arg> </bean> </simple:invoker> </simple:server> <simple:server id="inlineSoapBinding" serviceClass="org.apache.cxf.service.factory.HelloService" serviceBean="#greeter" address="http://localhost:8080/test" serviceName="t:HelloService" xmlns:t="http://apache.org/hello_world_soap_http" endpointName="t:HelloPort" > <simple:binding> <soap:soapBinding mtomEnabled="true" version="1.2"/> </simple:binding> </simple:server> </beans> Configure with Spring for the simple front end clientYou could use the <simple:client> element to configure the simple front end client, you can use the spring's getBean API to get the client instance from the application context. <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:simple="http://cxf.apache.org/simple" 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/simple http://cxf.apache.org/schemas/simple.xsd"> <simple:client id="client" serviceClass="org.apache.cxf.service.factory.HelloService" address="http://localhost:9000/foo2" serviceName="s:XMLService" xmlns:s="http://apache.org/hello_world_soap_http" endpointName="s:XMLPort" bindingId="http://cxf.apache.org/bindings/xformat"/> </beans> The simple:client element supports many additional attributes:
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:simple="http://cxf.apache.org/simple" 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/simple http://cxf.apache.org/schemas/simple.xsd"> <bean id="saajIn" class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor"/> <bean id="saajOut" class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor"/> <simple:client id="client1" serviceClass="org.apache.cxf.service.factory.HelloService" address="http://localhost:9000/foo" serviceName="s:SOAPService" xmlns:s="http://apache.org/hello_world_soap_http"> <simple:binding> <soap:soapBinding mtomEnabled="true" version="1.2"/> </simple:binding> <simple:inInterceptors> <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/> <ref bean="saajIn"/> </simple:inInterceptors> <simple:outInterceptors> <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/> <ref bean="saajOut"/> </simple:outInterceptors> <simple:conduitSelector> <bean class="org.apache.cxf.endpoint.NullConduitSelector"/> </simple:conduitSelector> </simple:client> </beans> |
Unsubscribe or edit your notifications preferences
