Develop client applications
A client application performs business logic and makes use of the framework provided by an underlying client. Developing the code for a client application depends on the objects and functions we want to exploit, and the programming model to use.
Install the software development resources needed to develop client applications for use with WebSphere Application Server. During code development, we do not need access to the WAS. However, to assemble some types of client applications we need to install files for the client that provides the framework for the client application. Instead of installing WAS we can install the Application Client feature, which provides the same resources and clients to aid development of client applications.
To use a client application to access a remote object on an application server, develop the client application code as described in the following steps and the related topics. These topics only describe the client-specific considerations; they do not describe general client programming models, which we should already be familiar with. Samples for different types of client applications are provided with the Application Client.
Tasks
- Choose the type of client to use as a framework for our client application. Decision factors for choosing a client include whether we want to run a client application on Java EE or J2SE; whether we want ease of use with a small installation footprint or full-function with medium-large footprint; and whether we need licence to copy or redistribute the client. For more information about choosing the type of client, see Choose a type of client.
- Develop the client application code. The following substeps are a high-level general procedure. Information specific to a type of client is given in the related tasks.
- Create an instance of the object to access on the remote server. Use full JNDI support to get a suitable reference to administered objects from the server's JNDI namespace. Alternatively, we can get suitable references to objects programmatically without using JNDI.
Use the javax.naming.InitialContext class, the client application program uses the lookup operation to access the JNDI namespace. The InitialContext class provides the lookup method to locate resources.
We can compare the use of JNDI and programmatic techniques by looking at the samples provided for the Java EE client and Java thin client in an Application Client installation (for example, in C:\wac70\samples\src\):
- Java EE client use of JNDI for BasicCalculatorHome: TechnologySamplesJ2EEClient\BasicCalculator\com\ibm\websphere\samples\technologysamples\basiccalcclient\BasicCalculatorClientJ2EE.java
- Java thin client programmatic retrieval of BasicCalculatorHome: TechnologySamplesThinClient\BasicCalculator\com\ibm\websphere\samples\technologysamples\basiccalcthinclient\BasicCalculatorClientThin.java
- Create a connection to the server. If the server runs with security enabled, we can configure secure connections.
- Work with the objects to perform the business requirements. For example, send and receive JMS messages, update database entries, handle error conditions, and close resources used.
- Compile or assemble the client application. This creates the JAR or EAR file that we can deploy to make the client application available for use.
To compile the client application, include the JAR files needed in the CLASSPATH setting for the javac command; for example, any extra JAR files for the client application's own classes, JAR files for IBM Thin clients used, and JAR files for JDBC provider classes.
IBM-provided clients are not packaged with JDBC provider classes. For example, the WAS v7.0 Java Thin application client is not packaged with Apache Derby 10.2 classes. If our client application needs to use a database class (such as through the JNDI lookup of a datasource), we must obtain the class files from the database provider and make them available when compiling and running the client application.
What to do next
After you develop a client application, deploy it into the environment we want it to run.
Subtopics
- Choosing a type of client
A client provides the framework for client applications that run separately from the application server.- Develop stand-alone thin client applications
Develop the application code, then assemble the code into a client application that we can deploy on a client machine.- Develop a Java EE client application
Develop code for a Java EE client application.- Develop a Java thin client application
Develop the application code, then assemble the code into a client application that we can deploy on a client machine.- Develop ActiveX client application code
Develop an ActiveX Windows program, such as Visual Basic, VBScript, and Active Server Pages, to use the WebSphere ActiveX to EJB bridge to access enterprise beans.- Develop applet client code
Applet clients are capable of communicating over the HTTP protocol and the RMI-IIOP protocol.- Example: Enabling logging and tracing for application clients
The ActiveX to EJB bridge provides two logging and tracing formats: Windows Application Event Log and Java Trace Log.
Related:
Application Client for WAS Types of client applications Developing applications that use JNDI Deploy client applications Choose a type of client Deploy client applications Lookup names support in deployment descriptors and thin clients Install the application serving environment Application Client installation information