欢迎来到天天文库
浏览记录
ID:8806282
大小:63.50 KB
页数:11页
时间:2018-04-08
《cxf请求webservice超时区分》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、CXF请求超时区分设置超时代码JaxWsDynamicClientFactoryclientFactory=JaxWsDynamicClientFactory.newInstance();Stringurl="http://192.168.1.56:7001/test?WSDL";ClientclientTemp=clientFactory.createClient(url);HTTPConduithttp=(HTTPConduit)clientTemp.getConduit();HTTPClientPolicyhttpClien
2、tPolicy=newHTTPClientPolicy();httpClientPolicy.setConnectionTimeout(10);//连接超时httpClientPolicy.setAllowChunking(false);//取消块编码httpClientPolicy.setReceiveTimeout(1000);//响应超时http.setClient(httpClientPolicy);Object[]arg;Stringresult="";try{arg=clientTemp.invoke("testMot
3、hd","8698053");result=(String)arg[0];}catch(Exceptione){e.printStackTrace();}这部分代码大家在网络上随便搜索都能得到,这个就是CXF设置连接的超时与响应时间的方法。当然小编主要讲的不是这个,主要来说下到底如何区分连接超时,还是响应超时。分析请求错误(5大种)创建Client类时,URL无效Exceptioninthread"main"org.apache.cxf.service.factory.ServiceConstructionException:Co
4、uldnotresolveURL"http://www.qq.com/e?WSDL".atorg.apache.cxf.endpoint.dynamic.DynamicClientFactory.composeUrl(DynamicClientFactory.java:566)atorg.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:253)atorg.apache.cxf.endpoint.dynam
5、ic.DynamicClientFactory.createClient(DynamicClientFactory.java:198)atorg.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:191)atorg.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:146)atCli
6、entTest.soap(ClientTest.java:141)atClientTest.main(ClientTest.java:167)Causedby:java.io.FileNotFoundException:http://www.qq.com/e?WSDLatsun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1241)atorg.apache.cxf.resource.URIResolver.tryFile
7、System(URIResolver.java:167)atorg.apache.cxf.resource.URIResolver.(URIResolver.java:90)atorg.apache.cxf.endpoint.dynamic.DynamicClientFactory.composeUrl(DynamicClientFactory.java:558)...6more创建Client类时,URL有效,连接超时Exceptioninthread"main"org.apache.cxf.service.fact
8、ory.ServiceConstructionException:CouldnotresolveURL"http://192.168.1.56:7001/test?WSDL".atorg.apache.cxf.endpoint.dynamic.Dy
此文档下载收益归作者所有