1 将 wevservice 客户端 通过<jaxws:client>元素,注入到spring的配置文件中,类似<jaxws:endpoint>元素被用户服务端 2 具体的例子 <?xml version="1.0" encoding="UTF-8"?> <jaxws:client>元素说明: id: String类型,唯一标识,可以被spring的bean进行调用 serviceClass:Class 类型,内容为完整的类名称,SEI 接口名 address:QName 类型,对应wsdl:service@name. endpointName :QName,对应wsdl:port@name wsdlLocation:URL类型,A URL to connect to in order to retrieve the WSDL for the service. This is not required 3 更详细的例子 <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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"> <!-- Interceptors extend e.g. org.apache.cxf.phase.AbstractPhaseInterceptor --> <bean id="anotherInterceptor" class="..." /> <!-- Handlers implement e.g. javax.xml.ws.handler.soap.SOAPHandler --> <bean id="jaxwsHandler" class="..." /> <!-- The SOAP client bean --> <jaxws:client id="helloClient" serviceClass="demo.spring.HelloWorld" address="http://localhost:9002/HelloWorld"> <jaxws:inInterceptors> <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/> <ref bean="anotherInterceptor"/> </jaxws:inInterceptor> <jaxws:handlers> <ref bean="jaxwsHandler" /> </jaxws:handlers> <jaxws:properties> <entry key="mtom-enabled" value="true"/> </jaxws:properties> </jaxws:client> </beans>
<jaxws:client>子元素:
jaxws:inInterceptors:拦截器,必须实现Each should implement org.apache.cxf.interceptor.Interceptor or org.apache.cxf.phase.PhaseInterceptor
jaxws:handlers:处理类,必须实现javax.xml.ws.handler.Handler or javax.xml.ws.handler.soap.SOAPHandler.
jaxws:properties :属性, MAP
|
CXF之十 jax-ws spring client 详解
最新推荐文章于 2022-05-01 21:44:06 发布