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 you want to exploit, and the model that you want to use.

Install the software development resources needed to develop client applications for use with WAS. During code development, you 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. For information about installing the Application Client on a development machine, see Install Application Client for WAS.

To use a client application to access a remote object on an appserver, 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 models, which you should already be familiar with. Samples for different types of client applications are provided with the Application Client.

 

  1. Choose the type of client to use as a framework for the client application. Decision factors for choosing a client include whether you want to run a client application on Java EE or J2SE; whether you 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.

    See about choosing the type of client, see Choose a type of client.

  2. 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.

    1. 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 Java Naming and Directory Interface (JNDI) namespace. The InitialContext class provides the lookup method to locate resources. You 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

    2. Create a connection to the server. If the server runs with security enabled, we can configure secure connections.

    3. 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.

  3. 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 the client application needs to use a database class (such as through the JNDI lookup of a datasource), obtain the class files from the database provider and make them available when compiling and running the client application.

 

Next steps

After you develop a client application, deploy it into the environment you want it to run.


Install Application Client for WAS
Develop stand-alone thin client applications
Develop a Java EE client application
Develop a Java thin client application
Develop ActiveX client application code
Develop applet client code

 

Related concepts


Application Client for WAS

 

Related tasks


Develop applications that use JNDI
Deploy client applications

 

Related


Lookup names support in deployment descriptors and thin clients