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

来源:互联网 发布:补码如何转换成源码 编辑:程序博客网 时间:2024/06/07 06:00
<?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.xsdhttp://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);


 

原创粉丝点击