Call a Jaguar component from PB(this howto is deprecated)Tag(s): DEPRECATED


// through the load balancing Name Service
connection l_connection
nvo_test lnvo_test
l_connection = CREATE connection
l_connection.driver = 'Jaguar'
l_connection.location = 'iiop://JagOne:9000;iiop://JagTwo:9000'
l_connection.application = ''
l_connection.userid = 'jagadmin'
l_connection.password = ''
li_result = l_connection.ConnectToServer()
l_connection.CreateInstance(lnvo_test, "p_test/n_test")
ls_return = lnvo_test.f_test('some data string value')
l_connection.DisconnectServer()
SetNull(lnvo_test)
SetNull(l_connection)
directly, bypassing/ignoring the Name Service
// let's check for errors this time.
// Not that error checking helps mind you,
// CORBA errors still bomb the application.

JaguarORB l_JaguarORB
CORBAObject l_CorbaObject
Manager l_manager     // see this HowTo
Session l_session
nvo_test lnvo_test

l_JaguarORB = CREATE JaguarORB

ll_return = l_JaguarORB.init("ORBRetryCount=3, ORBRetryDelay=1000")
IF ll_return <> 0 THEN
 MessageBox('jaguar orb','init failed',StopSign!)
 RETURN
END IF

ll_return = l_JaguarORB.String_To_Object &
  ('iiop://JagOne:9000',l_CorbaObject)
IF ll_return <> 0 THEN
 MessageBox('jaguar orb','string to object failed',StopSign!)
 RETURN
END IF

ll_return = l_CorbaObject._narrow &
   (l_manager, "SessionManager/Manager")
IF ll_return <> 0 THEN
 MessageBox('corba object','narrow failed',StopSign!)
 RETURN
END IF

l_session = l_manager.createSession("jagadmin", "")
IF NOT IsValid(l_session) THEN
 MessageBox('manager','create session failed',StopSign!)
 RETURN
END IF

l_CorbaObject = l_session.create("p_test/nvo_test")
IF NOT IsValid(l_CorbaObject) THEN
 MessageBox('session','lookup failed',StopSign!)
 RETURN
END IF

l_CorbaObject._narrow(lnvo_test, "p_test/nvo_test")
IF NOT IsValid(lnvo_test) THEN
 MessageBox'lnvo_test','narrow failed',StopSign!)
 RETURN
END IF

ls_return = lnvo_test.f_test('some data string value')

Thanks to RobbGolds


blog comments powered by Disqus