<!-- 引入CXF Bean定义如下,早期的版本中使用 --> <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="one" implementor="com.hcm.service.OneService" address="/one"> </jaxws:endpoint> <!-- 发布一个服务,没有指定接口 --> <jaxws:server id="two" address="/two" serviceClass="com.hcm.service.ITwoService"> <jaxws:inInterceptors> <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"></bean> </jaxws:inInterceptors> <jaxws:outInterceptors> <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"></bean> </jaxws:outInterceptors> <jaxws:serviceBean> <!-- 指定发布类,下面类必须添加@WebService注解 --> <bean class="com.hcm.service.impl.ITwoServiceImpl"></bean> </jaxws:serviceBean> </jaxws:server>
<!-- 引入CXF Bean定义如下,早期的版本中使用 --> <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:client id="twoService" address="http://localhost:8080/CXFServerSpring_02/ws/two" serviceClass="com.autoclient.Two"> </jaxws:client>
<context-param> <param-name>contextConfigLocation</param-name> <param-value> /WEB-INF/cxf-servlet.xml </param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <servlet> <servlet-name>cxf</servlet-name> <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>cxf</servlet-name> <url-pattern>/ws/*</url-pattern> </servlet-mapping>