How to
Invoke EJB/CORBA Object
by Using EJB/CORBA Connector in iASP
To invoke specified EJB/CORBA object in ASP file by using EJB/CORBA Connector once iASP EJB/CORBA connector is installed on your system.
You can implement them according to the following three steps:
1. EJB/CORBA Connector installation
You should first get a licensed copy of EJB/CORBA Connector from Halcyon Software, and make sure just execute the installation program.
First, the installation will prompt:
Which Application Server(s) to connect?
2. EJB/CORBA Connector configuration
For example, in Session Demo sample, after building the EJB sample for weblogic and restart WebLogic server, add the following line to the classpath in <iASP installed path>\start-server.bat file:
d:\weblogic\classes;d:\weblogic\lib\unpacked_jars\javax_ejb.zip; d:\weblogic\lib\unpacked_jars\jndi.jar;d:\weblogic\lib\unpacked_jars\collections.zip; d:\weblogic\classes\statefulSession.jar (Note: assume you have installed WebLogic into d:\weblogic and Instant ASP into d:\iasp;)
Note: These Application Servers can locate on the same machine installed iASP, but if it locate on other system via the networking environment, you need to copy their relative class files to the same machine installed iASP, and add them to your classpath in <iASP installed directory>/start-server.bat(or start-server.sh) file.
Note: Assuming your application Server name is myapps, assuming your application server support both EJB and CORBA, assuming the name of ejb object is myejb, the name of corba object is mycorba.
Please add the following lines into the <iASP installed path>/properties/ejb.properties file.
#myapps myapps.INITIAL_CONTEXT_FACTORY = myapps.jndi.factoryname myapps.PROVIDER_URL = //host:port/
Constant | Equal to | Description |
INITIAL_CONTEXT_FACTORY | java.naming.factory.initial | This is constant that holds the name of the environment property for specifying the initial context factory to use. |
PROVIDER_URL | java.naming.provider.url | This is constant that holds the name of the environment property for specifying configuration information for the service provider to use. |
Some application servers also need to specify other constants, following table lists all constants, you maybe need them according to what your specified application server needs.
Constant | Equal to | Description |
AUTHORITATIVE | java.naming.authoritative | Constant that holds the name of the environment property for specifying the authoritativeness of the service requested. |
BATCHSIZE | java.naming.batchsize | Constant that holds the name of the environment property for specifying the batch size to use when returning data via the service's protocol. |
DNS_URL | java.naming.dns.url | Constant that holds the name of the environment property for specifying the DNS host and domain names to use for the JNDI URL context (for example, "dns://somehost/wiz.com"). |
INITIAL_CONTEXT_FACTORY | java.naming.factory.initial | Constant that holds the name of the environment property for specifying the initial context factory to use. |
LANGUAGE | java.naming.language | Constant that holds the name of the environment property for specifying the preferred language to use with the service. |
OBJECT_FACTORIES | java.naming.factory.object | Constant that holds the name of the environment property for specifying the list of object factories to use. |
PROVIDER_URL | java.naming.provider.url | Constant that holds the name of the environment property for specifying configuration information for the service provider to use. |
REFERRAL | java.naming.referral | Constant that holds the name of the environment property for specifying how referrals encountered by the service provider are to be processed. |
SECURITY_AUTHENTICATION | java.naming.security.authentication | Constant that holds the name of the environment property for specifying the security level to use. |
SECURITY_CREDENTIALS | java.naming.security.credentials | Constant that holds the name of the environment property for specifying the credentials of the principal for authenticating the caller to the service. |
SECURITY_PRINCIPAL | java.naming.security.principal | Constant that holds the name of the environment property for specifying the identity of the principal for authenticating the caller to the service. |
SECURITY_PROTOCOL | java.naming.security.protocol | Constant that holds the name of the environment property for specifying the security protocol to use. |
URL_PKG_PREFIXES | java.naming.factory.url.pkgs | Constant that holds the name of the environment property for specifying the list of package prefixes to use when loading in URL context factories. |
Start your application server and make sure your EJB/CORBA object is running.
Start your web server.
3. How to invoke EJB/CORBA object in your ASP file
in ASP file, using CreateObject method to invoke specified EJB/CORBA Server, the following explains how to invoke specified EJB/CORBA object in different Application servers by using ASP script.
Assuming your application Server name myapps, assuming your application server support both EJB and CORBA, assuming the name of ejb object is myejb, the name of corba object is mycorba.
set demo = server.createobject("ejb.myapps:myejb1")
Setting Description ejb.myapps the application server you need to connect is myapps, it is EJB object to invoke by your ASP application. myejb1 represents the specified EJB object.
set demo = server.createobject("corba.myapps:mycorba1")
Setting Description ejb.myapps the application server you need to connect is myapps, it is CORBA object to invoke by your ASP application. myejb1 represents the specified CORBA object.
In the following, we will also illustrate how to implement them with Weblogic, Netdynamic and Oracle application servers.
#case Oracle Application Server oas.java.naming.factory.url.pkgs = oracle.oas.jndi oas.java.naming.provider.url = oas://host:port/For EJB, the code should be as following:
set demo = server.createobject("ejb.oas:StackDemo/ServerStack")
Setting Description ejb.oas the application server you need to connect is Oracle Application Server, it is EJB object to invoke by your ASP application. StackDemo/ServerStack represents the specified EJB object. For CORBA, because it is jcorba object in Oracle Application Server, the code should be like the following:
set demo = server.createobject("jco.oas:StackDemo/ServerStack")
#case Weblogic Application Server
weblogic.java.naming.factory.initial = weblogic.jndi.WLInitialContextFactory
weblogic.java.naming.provider.url = t3://host:port/For EJB,
set demo = server.createobject("ejb.weblogic:statefulSession/TraderHome")If invoking is corba object, the parameter of createobject should be "corba.weblogic:statefulSession/TraderHome".
#case Netdynamics Application Server netdynamics.java.naming.factory.initial = netdyn.naming.spi.CNdEJBNamingInitCtxFactory netdynamics.java.naming.security.principal = Studio netdynamics.java.naming.security.credentials = StudioFor EJB,
set demo = server.createobject("ejb.Netdynamics:com/netdynamics/demo/Phonebook/PhonebookDemo")If invoking is corba object, the parameter of createobject should be "corba.Netdynamics:com/netdynamics/demo/Phonebook/PhonebookDemo".
How to Invoke CORBA with Visibroker
In addition, if you are running iASP to invoke CORBA with visibroker, the code should be like the following:
set demo =server.createobject("corba.visibroker:BankManager")
More information about purchasing these components, please consult Halcyon Software Inc.
Copyright © 1998-2000, Halcyon Software Inc. All rights reserved.