New CORBA Connector Wizard


This wizard generates a client that will connect to a CORBA service.

Overview

Before using this wizard, you must select a NXTware CORBA project.

Procedure

From the New > Other > NXTware_CORBA > CORBA, select New CORBA Connector.



The wizard will scan the project and fill the different fields. You can modify them if you wish.



Click the Finish button.
The generated class will appear inside your project.



Using the Connector Class

Here is an example of using a Connector class.

Using the current project, create a TestApp class.



In your import declaration, add those entries:
import nxtware.corba.connectors.orb.*;
import nxtware.corba.connectors.Locator.LOCATOR_TYPE;

We will create an instance of an ORBConnector class. This class has two constructors. An empty constructor that will try to find a ORBProperties.xml file in the classpath. The second constructor will take a ORBProperties.xml file as a parameter.

The ORBConnector class handles the initialization of the orb.

Please read the ORBProperties section to find out more about using this class.

ORBConnector orb = new ORBConnector();

Next, we create an instance of our connector.

TaxServiceConnector taxConnector = new TaxServiceConnector(orb.getORB(), "TaxService", LOCATOR_TYPE.SearchService);

The first parameter is the ORB that was initialized by the ORBConnector class.
The second parameter is the service's name.
The third parameter is the naming service that we want to query in order to get a reference. There are two types of naming service that you can pass.
LOCATOR_TYPE.NamingService is the standard vendor's naming service.
LOCATOR_TYPE.SearchService is the NXTware naming service

Finally we call the remote method.

TaxData td = taxConnector.getAmount(new TaxInfoIn("ny", (float)345.23));

Your TestApp class should look like this:

package ecommTax.implementation;

import ecommTax.*;
import nxtware.corba.connectors.orb.*;
import nxtware.corba.connectors.Locator.LOCATOR_TYPE;

public class TestApp {

public static void main(String[] args) throws Exception {
ORBConnector orb = new ORBConnector();
TaxServiceConnector taxConnector = new TaxServiceConnector(orb.getORB(), "TaxService", LOCATOR_TYPE.SearchService);
TaxData td = taxConnector.getAmount(new TaxInfoIn("ny", (float)345.23));
}

}