每个股票交易接口程序,接口调用都有自己环境,先排查原因
二新增股票交易接口程序,接口调用,数据没有推送过去E化平台,上叙中665没开通网络。但是已经开通,现在还是没有推送数据,看股票交易接口程序,接口调用是通的继续排查。结果查询:是对方验证没有验证对的地方,问题解决
HttpPost封装的请求,但是这个是否会变成GET请求?
调查
问题还没有解决浏览器访问
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Wed Nov 18 16:43:19 CST 2020
There was an unexpected error (type=Method Not Allowed, status=405).
Request method 'GET' not supported
问题用户反馈,上传文档非常缓慢查看实时日志如下:分析日志,发现一个外调股票交易接口程序,接口连接超时。股票交易接口程序,接口一直请求超时,:http://rbs-prcignacmcom:4444/anno/transferClose网络权限,http://rbs-prcignacmcom:4444是否开通有申请过网络权限,这个原有常用地址,有权限。curl命令访问查看,405方法不允许,显示Get请求不允许排查股票交易接口程序,接口对接,是否不是post,对接的是POST.排查rbs-prcignacmcom:4444负载到159和160正常吗?负载正常的,下面截验证的端口都是通的,下面的都有返回码:40请确认下请求http://rbs-prcignacmcom:4444/anno/transferClose是正确的吗?下面截的405没关系,这个是直接使用url访问是get请求,我们是post请求,这个没关系贴出代码请求如下:
public static ResultMsg toRbs(String url, Map param){
ResultMsg resultMsg = new ResultMsg();
DateTime currTime = new DateTime(new Date(),16);
CloseableHttpClient client = getHttpClient();
HttpPost post = new HttpPost(url);
String req = JSON.toJSONString(param);
logger.info(currTime+':'+url+':发送请求:'+req);
StringEntity entity = new StringEntity(req, Charset.forName('UTF-8'));
entity.setContentType('application/json');
post.setEntity(entity);
CloseableHttpResponse response = null;
String rstCode,rstMsg;
try {
response = client.execute(post);
if (response != null) {
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != HttpStatus.SC_OK) {
resultMsg.setFlag(false);
resultMsg.setMsg('连接失败,错误代码为:' + String.valueOf(statusCode));
return resultMsg;
}
HttpEntity entity1 = response.getEntity();
String result = org.apache.http.util.EntityUtils.toString(entity1, 'UTF-8');
logger.info('{股票交易接口程序,接口返回数据}' + result);
com.alibaba.fastjson.JSONObject json= com.alibaba.fastjson.JSONObject.parseObject(result);
rstCode = json.getString('code');rstMsg = json.getString('msg');
if ('200'.equals(rstCode)) {
resultMsg.setFlag(true);
resultMsg.setMsg(rstMsg);
}else {
resultMsg.setFlag(false);
resultMsg.setMsg('股票交易接口程序,接口异常:'+rstMsg);
}
} else {
resultMsg.setFlag(false);
resultMsg.setMsg('连接股票交易接口程序,接口失败');
}
} catch (Exception e) {
resultMsg.setFlag(false);
resultMsg.setMsg(e.getMessage());
logger.error(e);
} finally {
try {
post.releaseConnection();
} catch (Exception e) {
logger.error(e);
}
}
return resultMsg;
}
文章为作者独立观点,不代表股票交易接口观点