cxf本地传输JAX_WS

时间:2017-07-12 09:01:01

标签: cxf jax-ws

我正在使用CXF框架来实现JAX_WS soap web服务。我想利用本地传输在另一个Web服务中调用web服务而不使用实际端点。任何例子?

JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); 
        factory.setServiceBean(new LocalTransportSample_Service().getLocalTransportSamplePort()); 
        factory.setAddress("local://hello"); 
        factory.setTransportId(LocalTransportFactory.TRANSPORT_ID); 
        Server  server = factory.create(); 
                JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean(); 
        proxyFac.setAddress("local://hello"); 
       proxyFac.getClientFactoryBean().setTransportId(LocalTransportFactory.TRANSPORT_ID); 
        LocalTransportSample exc = proxyFac.create(LocalTransportSample.class);       
       return exc.hello("I am from local transport");

1 个答案:

答案 0 :(得分:0)

JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); 
        factory.setServiceBean(new LocalTransportSample_Service().getLocalTransportSamplePort()); 
        factory.setAddress("local://hello"); 
        factory.setTransportId(LocalTransportFactory.TRANSPORT_ID); 
        Server  server = factory.create(); 
                JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean(); 
        proxyFac.setAddress("local://hello"); 
       proxyFac.getClientFactoryBean().setTransportId(LocalTransportFactory.TRANSPORT_ID); 
        LocalTransportSample exc = proxyFac.create(LocalTransportSample.class);       
       return exc.hello("I am from local transport");