}
private String invokeExternalService(
ExternalServiceConfiguration serviceConfig, JSONArray records) throws RemoteException {
ExportRecordsServiceProxy proxy = new ExportRecordsServiceProxy();
proxy.setEndpoint(serviceConfig.getEndpoint());
SourceBean sb = (SourceBean) ConfigSingleton.getInstance().getAttribute("QBE.EXTERNAL_SERVICES");
int timeout = Integer.parseInt((String) sb.getAttribute("timeout"));
proxy.setTimeout(timeout);
String result = null;
try {
result = proxy.processRecords(records.toString(), serviceConfig.getOperation());
} catch (RemoteException e) {
if (e.detail != null && e.detail instanceof SocketTimeoutException) {
throw new SpagoBIEngineServiceException(getActionName(), "Service invocation produced a timeout error", e);
} else {
throw e;