关于,java-webservice接口,根据服务端,自动生成客户端调用时,响应时间慢

我这边遇到的问题,是在和对方进行webservice接口交互的时候,用工具,调用对方的webservice接口,对方响应很快。但是用java生成的客户端调用就会很慢才得到响应。大概有5分钟左右。

这里我百度了下,百度上说的是因为http1.0和http1.1的差别,[https://blog.csdn.net/u012470138/article/details/53034327]
j

加上这段之后,在吃调用就好了。_call.setProperty(org.apache.axis.MessageContext.HTTP_TRANSPORT_VERSION, HTTPConstants.HEADER_PROTOCOL_V11);

以下是完整代码:

    public String[] syncAwAcc(String name, String password, String jsonData) throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
  //这里是我加的代码
_call.setProperty(org.apache.axis.MessageContext.HTTP_TRANSPORT_VERSION, HTTPConstants.HEADER_PROTOCOL_V11);
_call.setOperation(_operations[1]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://sopeProject.ft.com/", "SyncAwAcc"));

setRequestHeaders(_call);
setAttachments(_call);
try { Object _resp = _call.invoke(new Object[] {name, password, jsonData});

if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (String[]) _resp;
} catch (Exception _exception) {
return (String[]) org.apache.axis.utils.JavaUtils.convert(_resp, String[].class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
throw axisFaultException;
}
}

以上仅供参考,学习,以共勉

posted @ 2018-11-26 15:30  darling331  阅读(398)  评论(0编辑  收藏  举报