CXF& SSL:タイムアウトのトラブル
-
03-07-2019 - |
質問
Apache CXFを使用してHTTPS経由でWebサービスにアクセスするために使用しようとしている次のコードがあります。しかし、メッセージが送信されるたびに、コードがタイムアウトするまで何も返されません。誰かが私のコードをもう一度教えて、私が何か間違っているのかどうかを教えてもらえますか? SoapUIを介してサービスにアクセスしようとしましたが、それで問題ありません。CXFコードに含まれている必要がありますが、何がわからないだけです!
ご協力ありがとうございます
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);
解決
SoapUIからの応答時間は?
これをモニターで実行して、適切な場所に送信されていることを確認しましたか?
私のCXFコードは次のようになります。
PService phsService = new PService(url, SERVICE_NAME);
P p = phsService.getPHSPort();
LOG.info("Calling Web Service : getHs");
StringArray ar = p.getHs();
for (String hn: ar.getItem()) {
LOG.info("Calling : getHName : " + hn);
Dto nDto = p. getHName (hn);
// process the result
}
このサービスは復帰するまで約90秒かかり、正常に実行されます
所属していません StackOverflow