0
我有下面的代碼,我正嘗試通過使用Apache CXF通過HTTPS訪問web服務。但是,只要我的信息消失,我的代碼超時之前我什麼也收不回來。有人可以給我的代碼一次,讓我知道如果我做錯了什麼。我試圖通過SoapUI訪問服務,這很好,所以它必須是我的CXF代碼中的東西,但我只是不知道該怎麼做!CXF&SSL:超時問題
感謝所有幫助
DepositImplService ss = new DepositImplService(WSDL_LOCATION,
SERVICE_NAME);
PortType port = ss.getPortTypePort();
Client client = ClientProxy.getClient(port);
HTTPConduit conduit = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = conduit.getClient();
httpClientPolicy.setConnectionTimeout(30000);
httpClientPolicy.setReceiveTimeout(30000);
conduit.setClient(httpClientPolicy);
AuthorizationPolicy authPolicy = new AuthorizationPolicy();
authPolicy.setUserName("foo");
authPolicy.setPassword("bar");
conduit.setAuthorization(authPolicy);
TLSClientParameters parameters = new TLSClientParameters();
parameters.setSecureSocketProtocol("SSL");
conduit.setTlsClientParameters(parameters);
client.getInInterceptors().add(new LoggingInInterceptor());
client.getOutInterceptors().add(new LoggingOutInterceptor());
UploadRequestT doc = new UploadRequestT();
BufferedReader reader = new BufferedReader(new FileReader(new File(
"C:\\rawmessage.txt")));
String documentStr = "";
String currLine = "";
while ((currLine = reader.readLine()) != null) {
documentStr += currLine;
}
doc.setDoc(documentStr);
doc.setOwner("43");
port.upload(doc);
響應時間幾乎是瞬間。監視工具的好主意 - 我會看看是什麼告訴我的。 – 2009-04-30 10:59:35