Webservice的cxf开发_使用spring配置客户端
发布时间:2020-12-16 21:58:14 所属栏目:安全 来源:网络整理
导读:1.配置客户端实体 !-- 客户端实体bean --jaxws:client id="myclient" address="http://localhost:8080/CxfTest/ws/myservice" serviceClass="cn.xt.client.IMyService" / 这里的servicesClass指的是cxf生成的客户端代码中的Service接口,spring通过这个接口
1.配置客户端实体
<!-- 客户端实体bean --> <jaxws:client id="myclient" address="http://localhost:8080/CxfTest/ws/myservice" serviceClass="cn.xt.client.IMyService" /> 这里的servicesClass指的是cxf生成的客户端代码中的Service接口,spring通过这个接口生成代理对象 2.注入到bean实体中 将myclient注入bean Test中 <bean id="test" class="cn.xt.client.Test"> <property name="service" ref="myclient"></property> </bean> 3.调用
ApplicationContext ctx = new ClassPathXmlApplicationContext("cxf.xml"); Test test = ctx.getBean("test",Test.class); IMyService service = test.getService();//JaxWsClientProxy service.sayHi(); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |