当前位置: 代码迷 >> Web前端 >> cxf webservice的二中调用方式
  详细解决方案

cxf webservice的二中调用方式

热度:1061   发布时间:2014-03-01 00:36:54.0
cxf webservice的2中调用方式
1.通过WSDL路径调用,这个不做说明。
2.通过ClientProxy调用:这个不需要路径中的“?wsdl”,直接连接server address
int outTime = 5000; // 毫秒
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
        try {
factory.setAddress(PropritesUtils.getValue("test.url"));
} catch (IOException e1) {
e1.printStackTrace();
return null;
}
        factory.getConduitSelector();
        factory.setServiceClass(ITest.class);
        factory.getInInterceptors().add(new LoggingInInterceptor());
        ITest t = (ITest)factory.create();
        Client proxy = ClientProxy.getClient(t);
        HTTPConduit conduit = (HTTPConduit)proxy.getConduit();
        HTTPClientPolicy policy = new HTTPClientPolicy();
        policy.setConnectionTimeout(outTime * 30);//
        policy.setReceiveTimeout(outTime * 30);
        conduit.setClient(policy);

        t.callback...(...);
  相关解决方案