我已经在web-logic 12c上部署了jaxws ri soap客户端,如果响应时间超出重复请求,请找到以下代码片段
public String getAuthZResponse(MerchantWebServiceSoap serviceSoap, String
strCmd, String strXML, int time)
throws InterruptedException,
ExecutionException
{
String response = "";
ExecutorService executor = Executors.newSingleThreadExecutor();
Future<String> future = executor.submit(new AuthZTask(serviceSoap, strCmd, strXML));// strCmd stands for command in soap request
try
{
response = future.get(time, TimeUnit.SECONDS);// time out here is 25 seconds
}
catch (TimeoutException e)
{
response = "Response time out!!";
future.cancel(true);
executor.shutdownNow();
}
executor.shutdownNow();
return response;
}
class AuthZTask implements Callable<String>
{
String strCmd = null, strXML = null;
MerchantWebServiceSoap serviceSoap = null;
public AuthZTask(MerchantWebServiceSoap serviceSoap, String strCmd, String strXML)
{
this.strCmd = strCmd;
this.strXML = strXML;
this.serviceSoap = serviceSoap;
}
@Override
public String call() throws Exception
{
String authorizeResponse = serviceSoap.callPaySecure(strCmd, strXML);
return authorizeResponse;
}
}
// jax rs soap client for action
@WebMethod(operationName = "CallPaySecure", action = "third party end point goes here")
@WebResult(name = "CallPaySecureResult", targetNamespace = "third party end point namepsace goes here")
@RequestWrapper(localName = "CallPaySecure", targetNamespace = "third party end point namepsace goes here", className = "CallPaySecure")
@ResponseWrapper(localName = "CallPaySecureResponse", targetNamespace = "third party end point namepsace goes here", className = "CallPaySecureResponse")
public String callPaySecure(
@WebParam(name = "strCommand", targetNamespace = "third party end point namepsace goes here")
String strCommand,
@WebParam(name = "strXML", targetNamespace = "third party end point namepsace goes here")
String strXML);
但是当从tomcat服务器执行相同的代码时,请求只会被发布一次。调用是服务器到服务器。 最早的帮助, 提前谢谢