IsRemoteDtoSuccessful
Use the IsRemoteDtoSuccessful method to integrate debugging into business rules. It validates a successful request is received prior to further processing.
IsRemoteDtoSuccessful method:
BRApi.Utilities.IsRemoteDtoSuccessful(SessionInfo, RemoteRequestResultDto)
Parameters:
-
si: SessionInfo object used to create connection objects
-
RemoteRequestResultDto - Result of execution including the status and any exceptions which may have occurred on the remote endpoint
-
Return: RemoteRequestResultDto - Returns True or False.
public class MainClass
{
public object Main(SessionInfo si, BRGlobals globals, object api, ExtenderArgs args)
{
var GatewayName = "apgate"; // Name of the Gateway
var RemoteMethodName = "RunOperation"; // Name of the method inside the SIC Function that will be called.
//DataTable non null dto and remote exception
//resultdtovaluetype is not null and there are remote exception
RemoteRequestResultDto objRemoteRequestResultDto0 = BRApi.Utilities.ExecRemoteGatewayBusinessRule(si, "TestReturnNonNullRemoteEx", null, GatewayName, RemoteMethodName);
try
{
bool ret = false;
ret = BRApi.Utilities.IsRemoteDtoSuccessful(si,objRemoteRequestResultDto0);
}
catch (Exception ex)
{
BRApi.ErrorLog.LogMessage(si, "ResultDto execption: " + ex.InnerException.Message.ToString());
}
//DataTable
//Failed - resultdtovaluetype is null and no remote exceptions
RemoteRequestResultDto objRemoteRequestResultDto = BRApi.Utilities.ExecRemoteGatewayBusinessRule(si, "TestReturnDataTable", new object[] {true}, GatewayName, RemoteMethodName);
BRApi.ErrorLog.LogMessage(si,"IsRemoteDtoSuccess.DataTable False = " + BRApi.Utilities.IsRemoteDtoSuccessful(si,objRemoteRequestResultDto).ToString());
//Success - resultdtovaluetype is not null and no remote exceptions
RemoteRequestResultDto objRemoteRequestResultDtoA = BRApi.Utilities.ExecRemoteGatewayBusinessRule(si, "TestReturnDataTable", new object[] {false}, GatewayName, RemoteMethodName);
BRApi.ErrorLog.LogMessage(si,"IsRemoteDtoSuccess.DataTable True = " + BRApi.Utilities.IsRemoteDtoSuccessful(si,objRemoteRequestResultDtoA).ToString());
//DataSet
//Failed - resultdtovaluetype is null and no remote exceptions
RemoteRequestResultDto objRemoteRequestResultDto1 = BRApi.Utilities.ExecRemoteGatewayBusinessRule(si, "TestReturnDataset", new object[] {true}, GatewayName, RemoteMethodName);
BRApi.ErrorLog.LogMessage(si,"IsRemoteDtoSuccess.Dataset False = " + BRApi.Utilities.IsRemoteDtoSuccessful(si,objRemoteRequestResultDto1).ToString());
//Success - resultdtovaluetype is not null and no remote exceptions
RemoteRequestResultDto objRemoteRequestResultDto1A = BRApi.Utilities.ExecRemoteGatewayBusinessRule(si, "TestReturnDataset", new object[] {false}, GatewayName, RemoteMethodName);
BRApi.ErrorLog.LogMessage(si,"IsRemoteDtoSuccess.Dataset True = " + BRApi.Utilities.IsRemoteDtoSuccessful(si,objRemoteRequestResultDto1A).ToString());
//Value
//Failed - resultdtovaluetype is null and no remote exceptions
RemoteRequestResultDto objRemoteRequestResultDto2 = BRApi.Utilities.ExecRemoteGatewayBusinessRule(si, "TestReturnValue", new object[] {true}, GatewayName, RemoteMethodName);
BRApi.ErrorLog.LogMessage(si,"IsRemoteDtoSuccess.ObjectValue False = " + BRApi.Utilities.IsRemoteDtoSuccessful(si,objRemoteRequestResultDto2).ToString());
//Success - resultdtovaluetype is not null and no remote exceptions
RemoteRequestResultDto objRemoteRequestResultDto2A = BRApi.Utilities.ExecRemoteGatewayBusinessRule(si, "TestReturnValue", new object[] {false}, GatewayName, RemoteMethodName);
BRApi.ErrorLog.LogMessage(si,"IsRemoteDtoSuccess.ObjectValue True = " + BRApi.Utilities.IsRemoteDtoSuccessful(si,objRemoteRequestResultDto2A).ToString());
//Exception
//Failed - resultdtovaluetype is null and there are remote exceptions
try
{
RemoteRequestResultDto objRemoteRequestResultDto3 = BRApi.Utilities.ExecRemoteGatewayBusinessRule(si, "TestReturnException", null, GatewayName, RemoteMethodName);
BRApi.Utilities.IsRemoteDtoSuccessful(si,objRemoteRequestResultDto3);
}
catch (Exception ex)
{
BRApi.ErrorLog.LogMessage(si, ex.InnerException.Message.ToString());
}
return null;
}
}


