spring整合webService(客户端)

来源:互联网 发布:mac怎么卸载驱动 编辑:程序博客网 时间:2024/06/05 19:31

前言:和上一篇博客参照

0.引入jar包

1.首先找到相应的.wsdl文件,在项目中生成相应的代码

2.配置一个applicationContext-cxf-client.xml

<?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/jaxws">
<jaxws:client id="orderClient" 
serviceClass= "cn.ljj.service.OrderWS" 
address= "http://localhost/day02_ws_cxf_spring/orderws">

<!--
<jaxws:outInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
<bean class="cn.ljj.interceptor.AddUserInterceptor">
<constructor-arg name="name" value="xfzhang"/>
<constructor-arg name="password" value="123456"/>
</bean>
</jaxws:outInterceptors>

          -->
</jaxws:client>
</beans>

3.需要调用的时候只要注入上面红色标记的bean


原创粉丝点击