当我点击第三方端点以获取响应时,它在我的批处理类中给出了异常
HTTP h = new HTTP();
HTTPRequest req = new HTTPRequest();
req.setEndPoint('MyEndpoint');
req.setMethod('GET');
req.setHeader('Authorization', 'Bearer '+accTokenWrpObj.access_token);
req.setHeader('Content-Type', 'application/json');
req.setTimeout(120000);
HTTPResponse res = h.send(req);
if(res.getStatusCode() == 200){
CustomerWrapper customerWrapObj = (CustomerWrapper)JSON.deserialize(res.getBody(), CustomerWrapper.CLASS);
return customerWrapObj.value;
}
else if(res.getStatusCode() == 401){
getAccessToken();
req.setHeader('Authorization', 'Bearer '+accTokenWrpObj.access_token);
res = h.send(req);
CustomerWrapper customerWrapObj = (CustomerWrapper)JSON.deserialize(res.getBody(), CustomerWrapper.CLASS);
return customerWrapObj.value;
}
return null;
我甚至已经使用了最大标注时间120000毫秒)。有什么办法可以解决这个问题?
谢谢