您的位置:首页 > 其它

CXF客户端访问服务端四种方式

2012-10-25 13:46 330 查看
<?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/schemas/jaxws.xsd">
<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="helloWorld" implementor="cxf.server.HelloWorldImpl" address="/HelloWorld" /> -->

<!-- 第二种方式 -->
<!--
<bean id="helloWorldImpl" class="cxf.server.HelloWorldImpl"/>
<jaxws:endpoint id="helloWorld" implementor="#helloWorldImpl" address="/HelloWorld"/>
-->

<!-- 第三种方式 -->
<jaxws:server id="helloWorld" serviceClass="cxf.server.HelloWorld" address="/HelloWorld">
<jaxws:serviceBean>
<bean class="cxf.server.HelloWorldImpl"/>
</jaxws:serviceBean>
</jaxws:server>

</beans>


第四种方式程序调用:

JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(PODownstreamWebService.class);
factory.setAddress("http://localhost/service/soap/xml/poDownstream");
PODownstreamWebService service = (PODownstreamWebService) factory.create();
PurchaseOrder purchaseOrder = new PurchaseOrder();
service.downPOToPAQ(purchaseOrder);


 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: