Java common.apex.runtime.impl.ExecutionException:服务器apex的文件意外结束

Java common.apex.runtime.impl.ExecutionException:服务器apex的文件意外结束,java,web-services,rest,salesforce,apex,Java,Web Services,Rest,Salesforce,Apex,我正在尝试调用apex Salesforce中的rest服务,但当我从Salesforce调用时,它工作不好,已经用ARC Chrome和我制作的Java程序尝试过了,并且运行良好。 当我设置最大超时时,给我这个错误 common.apex.runtime.impl.ExecutionException:服务器apex的文件意外结束 当我在没有超时的情况下更改它时,请给我: 发生意外错误:读取超时 所以我真的不知道发生了什么,我使用相同的逻辑脚本调用另一个Rest服务,它工作正常 这是我到现在为

我正在尝试调用apex Salesforce中的rest服务,但当我从Salesforce调用时,它工作不好,已经用ARC Chrome和我制作的Java程序尝试过了,并且运行良好。 当我设置最大超时时,给我这个错误

common.apex.runtime.impl.ExecutionException:服务器apex的文件意外结束

当我在没有超时的情况下更改它时,请给我:

发生意外错误:读取超时

所以我真的不知道发生了什么,我使用相同的逻辑脚本调用另一个Rest服务,它工作正常

这是我到现在为止的cod:

@future (callout=true)
    public static void SendNitrosOautIncluded(Decimal cantidadNitros, String id_cuenta) {

        HttpRequest req = new HttpRequest();
        HttpResponse res = new HttpResponse();
        Http http = new Http();
        try {
            map<String, Endpoint__c> endPoints = Endpoint__c.getall();
            Endpoint__c endPoint = endPoints.get('PtxAddNitros');
            String endPointPtx= (String)endPoint.get('Endpoint__c');
            System.debug(endPointPtx+id_cuenta);
            //req.setTimeout(60000);
            req.setEndpoint(endPointPtx+id_cuenta);
            req.setMethod('POST');
            req.setHeader('Content-Type', 'application/json; charset=utf-8');                  
            JSONGenerator gen = JSON.createGenerator(true); 
            gen.writeStartObject();
            gen.writeNumberField('credits', cantidadNitros);        
            //MANAGE RESPONSE
            String objSended= gen.getAsString();
            System.debug(objSended);
            req.setBody(objSended);            
            res = http.send(req);            
            String resp=res.getBody();            
            System.debug(resp);
            System.debug(res.toString());
            System.debug('STATUS:'+res.getStatus());
            System.debug('STATUS_CODE:'+res.getStatusCode());
           /* Map<String, Object> m =(Map<String, Object>)JSON.deserializeUntyped(resp);
            System.debug(m);
            //CONTROL DE ERRORES
            String data=(String)m.get('data');  
            String status=(String)m.get('status');  
            if(status.equals('200')){
                System.debug('CORRECTO');
            }*/




        } catch(System.CalloutException e) {
            facturaDeudor.errorMessage(e);
        }
    }
@future(callout=true)
包括公共静态void sendNitrosoaut(十进制cantidadNitros,字符串id_cuenta){
HttpRequest req=新的HttpRequest();
HttpResponse res=新的HttpResponse();
Http=newhttp();
试一试{
映射端点=端点_uuc.getall();
Endpoint_u_c Endpoint=endPoints.get('PtxAddNitros');
String endPointPtx=(String)endPoint.get('endPoint___c');
系统调试(endPointPtx+id_cuenta);
//请求设置超时(60000);
请求setEndpoint(endPointPtx+id_cuenta);
请求设置方法(“POST”);
请求setHeader('Content-Type','application/json;charset=utf-8');
JSONGenerator gen=JSON.createGenerator(true);
gen.writeStartObject();
gen.writeNumberField(“信贷”,cantidadNitros);
//管理响应
字符串objsend=gen.getAsString();
系统调试(OBJSEND);
要求设置实体(OBJSEND);
res=http.send(req);
String resp=res.getBody();
系统调试(resp);
调试(res.toString());
System.debug('STATUS:'+res.getStatus());
System.debug('STATUS_CODE:'+res.getStatusCode());
/*Map m=(Map)JSON.deserializeUntyped(resp);
系统调试(m);
//控制消错
字符串数据=(String)m.get('data');
字符串状态=(字符串)m.get('status');
如果(状态等于('200')){
系统调试('CORRECTO');
}*/
}catch(System.e){
错误消息(e);
}
}

问题是关于防火墙的,将URL的所有de地址都放在callout服务器的白名单中,它就可以工作了。
help.salesforce.com/articleView?id=000003652&type=1

问题是关于防火墙的,将URL的所有de地址都放在要调用的服务器的白名单中,它就会工作。