ITeye博客

cxf超时设置

openstudy · 2011-07-05 14:49 · webservice · 开源软件 · Markdown

http://download.oracle.com/docs/cd/E20686_01/English/Technical_Documentation/Web_Services/ProgrammersGuide/helpmain.htm?toc.htm?34314.htm

    //调用WebService
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setServiceClass(IHelloWorldService.class);
    factory.setAddress("http://localhost:9000/helloWorld");
    IHelloWorldService client = (IHelloWorldService) factory.create();
    
    ///开始超时设置
    Client proxy = ClientProxy.getClient(client);
    HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
    HTTPClientPolicy policy = new HTTPClientPolicy();
    policy.setConnectionTimeout(CXF_CLIENT_TIME_OUT);
    policy.setReceiveTimeout(CXF_CLIENT_TIME_OUT);
    conduit.setClient(policy);
    ///结束超时设置
        
    System.out.println(client.sayHello("test"));

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。