程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> JAVA編程 >> JAVA綜合教程 >> CXF調用webservice超時設置,cxfwebservice超時

CXF調用webservice超時設置,cxfwebservice超時

編輯:JAVA綜合教程

CXF調用webservice超時設置,cxfwebservice超時


在網上找了很多方法,終於找到了一個,記錄之。

JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
        factory.setServiceClass(Service1Soap.class);// 設置請求接口
        factory.setAddress("http://*.*.*.*/SMSService/Service1.asmx?WSDL");
        Service1Soap esbServer = (Service1Soap) factory.create(); // 創建客戶端對象
        // 設置客戶端的配置信息,超時等.
        Client proxy = ClientProxy.getClient(esbServer);
        HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
        HTTPClientPolicy policy = new HTTPClientPolicy();
        policy.setConnectionTimeout(10000); // 連接超時時間
        policy.setReceiveTimeout(10000);// 請求超時時間.
        conduit.setClient(policy);
        String _sendSms_account = "";
        String _sendSms_password = "";
        String _sendSms__return = "";
        _sendSms_account = "1";
        _sendSms_password = "2";
        esbServer.sendSms(_sendSms_account, _sendSms_password, "", "", "");
        System.out.println(System.currentTimeMillis() - a);

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved