CXF之十 jax-ws spring client 详解

1 将 wevservice 客户端 通过<jaxws:client>元素,注入到spring的配置文件中,类似<jaxws:endpoint>元素被用户服务端

2 具体的例子

<?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">

    <jaxws:client id="helloClient"
                  serviceClass="demo.spring.HelloWorld"
                  address="http://localhost:9002/HelloWorld" />
</beans>

<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 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值