Jump to Real's How-to Main page

Call a Jaguar component from ASP

NOTE: If you have installed EAServer on the same machine as the Web server then you don't need to install Jagclient.exe because it's already done.

Then from ASP, to call a CORBA component (like a PB component)

<%
theURL = "iiop://myjaguar:9000"
set aORB = Server.CreateObject("Jaguar.ORB")
aORB.init("")
Set aManager = 
  aORB.string_to_object(theURL).Narrow_("SessionManager/Manager")
Set aSession = 
  aManager.createSession("myuser","mypwd").Narrow_ 
     ("SessionManager/Session")
Set aFactory = aSession.lookup("MyPackage/MyComponent")
Set obj = aFactory.Create().Narrow_("MyPackage/MyComponent")

sz = obj.of_sayhello()
response.write sz

set obj = nothing
set aFactory = nothing
set aSession = nothing
set aManager = nothing
set aORB = nothing
%>
To call an EJB component
<%
theURL = "iiop://myjaguar:9000"
set aORB = Server.CreateObject("Jaguar.ORB")

aORB.init("")
Set aManager = 
  aORB.string_to_object(theURL).Narrow_("SessionManager/Manager")
Set aSession = 
  aManager.createSession("myuser","mypwd").Narrow_
    ("SessionManager/Session")
Set aFactory = aSession.lookup("MyPackage/MyComponentEJB")
Set objHome = aFactory.Narrow_("com/rgagnon/EJB/MyComponentHome")

Set obj = objHome.Create()

sz = obj.sayHello()

response.write sz

set objHome=nothing
set obj = nothing
set aFactory = nothing
set aSession = nothing
set aManager = nothing
set aORB = nothing
%>

Thanks to RobbGolds


If you find this article useful, consider making a small donation
to show your supportfor this Web site and its content.

Written and compiled by Réal Gagnon ©1998-2005
[ home ]