<?xml version="1.0" encoding="UTF-8"?>
<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.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" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<!-- 第一种方式 -->
<!-- <jaxws:endpoint id="helloWorld" implementor="cxf.server.HelloWorldImpl" address="/HelloWorld" /> -->
<!-- 第二种方式 -->
<!--
<bean id="helloWorldImpl" class="cxf.server.HelloWorldImpl"/>
<jaxws:endpoint id="helloWorld" implementor="#helloWorldImpl" address="/HelloWorld"/>
-->
<!-- 第三种方式 -->
<jaxws:server id="helloWorld" serviceClass="cxf.server.HelloWorld" address="/HelloWorld">
<jaxws:serviceBean>
<bean class="cxf.server.HelloWorldImpl"/>
</jaxws:serviceBean>
</jaxws:server>
</beans>
这是一个加入了interceptor或feature功能的配置实例。
<?xml version="1.0" encoding="UTF-8"?>
<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.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" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<!--
endpointName 属性 就是 wsdl:port的name属性,serviceName属性就是wsdl:service的name属性 ,
其实可以在java代码中用注解进行配置
-->
<jaxws:endpoint id="helloWorld"
implementor="cxf.server.HelloWorldImpl"
address="/HelloWorld"
endpointName="e:HelloWorldEP"
serviceName="s:HelloWorldSV"
xmlns:e="http://service.jaxws.cxf.apache.org/endpoint"
xmlns:s="http://service.jaxws.cxf.apache.org/service">
<jaxws:inInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
</jaxws:inInterceptors>
<jaxws:outInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
</jaxws:outInterceptors>
<!--
<jaxws:features>
<bean class="org.apache.cxf.feature.LoggingFeature"/>
</jaxws:features>
-->
</jaxws:endpoint>
</beans>
这是一个比较简单的CXF客户端配置,后面还有复杂一些的
<?xml version="1.0" encoding="UTF-8"?>
<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.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<!-- 第一种方式 -->
<!--
<bean id="client" class="cxf.server.HelloWorld" factory-bean="clientFactory" factory-method="create" />
<bean id="clientFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
<property name="serviceClass" value="cxf.server.HelloWorld" />
<property name="address" value="http://localhost:8085/java_first_spring_support1/service/HelloWorld" />
</bean>
-->
<!-- 第二种方式 -->
<jaxws:client id="client"
address="http://localhost:8085/java_first_spring_support1/service/HelloWorld"
serviceClass="cxf.server.HelloWorld" />
</beans>