Help: Error from executing BRApi.Utilities.ExecRemoteGatewayBusinessRule

liyinan357
New Contributor

Hello,

First time posting question here. I'm a developer new to the OneStream.

 

I'm trying to run a remote business rule to pull a file that stored on Local Gateway Server. The idea is to have the content of the data file returned to OS in bytes[]. 

I have extender rule  and SIC Function rule. After I executed the Extender rule, I printed out a few things from the returned object and looks like there is an exception when executing the remote rule. Could anyone give any pointers? Any help is appreciated!

 

 Error Returned
BRApi.ErrorLog.LogMessage(si,objRemoteRequestResultDto.RemoteException.StackTrace)
' Returned -> 
'    at OneStream.Shared.Wcf.RelayHostInfo.InvokeRequest(IRemoteRequestBase xfRequest)
'    at OneStream.Shared.Wcf.OneStreamRelayAgent.SendRelayRequest(IRemoteRequestBase xfRequest)
BRApi.ErrorLog.LogMessage(si,objRemoteRequestResultDto.RemoteException.GetBaseException.Message)
' Returned -> 
'    DirectConnection
BRApi.ErrorLog.LogMessage(si,objRemoteRequestResultDto.RemoteResultStatus)
' Returned -> 
'    64 (which indicates an exception)

 

Here is my extender rule

Imports System
Imports System.Data
Imports System.Data.Common
Imports System.IO
Imports System.Collections.Generic
Imports System.Globalization
Imports System.Linq
Imports Microsoft.VisualBasic
Imports System.Windows.Forms
Imports OneStream.Shared.Common
Imports OneStream.Shared.Wcf
Imports OneStream.Shared.Engine
Imports OneStream.Shared.Database
Imports OneStream.Stage.Engine
Imports OneStream.Stage.Database
Imports OneStream.Finance.Engine
Imports OneStream.Finance.Database
Imports WinSCP

Namespace OneStream.BusinessRule.Extender.YL_Test
	Public Class MainClass
		Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As ExtenderArgs) As Object
			Try
				Dim stepNumber As String = "1"
				BRApi.ErrorLog.LogMessage(si, "1") 
				
				If (Not args.NameValuePairs Is Nothing) Then
					' Extracting the value from the parameters collection                  
					If (args.NameValuePairs.Keys.Contains("step")) Then
						stepNumber = args.NameValuePairs.Item("step")
					End If 
					BRApi.ErrorLog.LogMessage(si, "File Processing Step: " & stepNumber) 
				End If 
                
				Select Case stepNumber         
					Case Is = "1"
						GetData(si)
						Return Nothing   
				End Select    
			Catch ex As Exception
				Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
			End Try
            
			Return Nothing
		End Function
   
		Public Sub GetData(ByVal si As SessionInfo)
                
			BRApi.ErrorLog.LogMessage(si,"Hello-GetData")  
			' YL_SIC_Function_Test is remote Business rule which is located in Smart Integration Function folder.
			' nonprod_sic_directconnection is the direct connect gateway name. It's setup on both OS and Local Gateway server and it's online
			' RunOperation is the function name in remote Business rule: YL_SIC_Function_Test
			Dim objRemoteRequestResultDto As RemoteRequestResultDto = BRApi.Utilities.ExecRemoteGatewayBusinessRule(si, "YL_SIC_Function_Test", Nothing, "nonprod_sic_directconnection",String.Empty,"RunOperation", True, 90)


			BRApi.ErrorLog.LogMessage(si,objRemoteRequestResultDto.RemoteException.StackTrace)
			BRApi.ErrorLog.LogMessage(si,objRemoteRequestResultDto.RemoteException.GetBaseException.Message)
			BRApi.ErrorLog.LogMessage(si,objRemoteRequestResultDto.RemoteResultStatus)
		End Sub    
        
	End Class
End Namespace

Here is my SIC Remote rule:

Imports System
Imports System.Collections.Generic
Imports System.Data
Imports System.Data.Common
Imports System.Globalization
Imports System.IO
'Imports System.Linq
Imports OneStreamGatewayService
Namespace OneStream.BusinessRule.SmartIntegrationFunction.YL_SIC_Function_Test
	Public Class MainClass
		Public Function RunOperation() As Byte()
			Dim filePath As String = "E:\\data_files\\Data_File.txt"
			Dim fileData As Byte() = File.ReadAllBytes(filePath)

			Return fileData

		End Function
	End Class
End Namespace

 

 

2 REPLIES 2

RobbSalzmann
Valued Contributor

Change/add the very first line of code to this:
What does it show in the log?:

BRApi.ErrorLog.LogMessage(si,objRemoteRequestResultDto.RemoteException.Message)

 

Thanks for your response!

I added the line of code and it printed out "DirectConnection"