CAA Web Services Home

 

Building and Launching a CAA Web Service Use Case

How to build and launch the CAA V5 use cases that demonstrate how to consume CAA Web services
Use Case

Abstract

This article explains how to set up a buildtime and runtime environment for the CAA Web service use cases that rely on Axis. It describes how to compile one or several code samples, and how to launch the related usage scenario samples.


What You Will Learn With This Use Case

The code samples delivered within CAA Web service use cases are intended to demonstrate how to write client applications that consume CAA Web services. The aim of this article is to help you build and run these code samples. It explains how to set up your buildtime and runtime environments using IRAD (IBM Rational Application Developer) 6, although any other Java IDE (Integrated Development Environment) or stand-alone JDK/JRE (Java Development Kit/Java Runtime Environment) could be used for that purpose. It uses a given CAA Web service use case as example, but the related concepts apply to any other available use case.

[Top]

The CAAXXXAxis1_3Client Use Cases

CAAXXXAxis1_3Client is a generic name for the CAA Web service use cases that rely on Axis 1.3. You should just replace XXX by the actual name of the CAA V5 use case you want to build and launch. To leave your CD-ROM installation as a safe reference, please create your project in a separate root directory for the CAA use cases in which you can freely copy, build, run, and possibly modify the use cases.

The code samples are only provided inside a typical CAA Web service framework/module architecture for convenience purpose. There is no prerequisite on either the CAA V5 buildtime or the CAA Web service runtime environment when using CAA Web services. In the following section, the code samples are imported from the CAA CD-ROM media for clarity. It is expected that you generate/write the related code yourself by referring to the use case describing how to consume the CAA Web service you wish to use.

[Top]

Step-by-step Using IRAD 6.0

The following section first describes how to set up the Axis prerequisites on your project, then how to import the use case code samples, and finally how to build the project. It then explains how to launch the related use case scenario. In the following, the CAAENOPosAppBinderAxis1_3Client use case [1] will be used for reference:

  1. Setting Up Your IRAD 6 Project
  2. Building the Use Case Code Samples
  3. Launching a Use Case Scenario

Setting Up Your IRAD 6 Project

There are various ways available for building client applications that rely on Axis. You can build the code with any Java IDE from the market, or even with the Apache Ant Java-based build tool for example. The only requirement is to set up the Axis prerequisites. See [2] for a detailed description of such prerequisites.

The following section describes how to build the code using IRAD 6.0. These steps could be performed in the almost exact same way when using IBM WSAD (WebSphere Studio Application Developer) 5.1.x or Eclipse 3.x. It demonstrates the use of the Axis 1.3 release, but it can be easily updated to match any other certified release.

Solution  If using Java 1.3, a few extra steps are required. These steps (7 to 16) are highlighted in red below. Their aim is to change the default JRE used but also to add Xerces related dependencies to the project classpath.

The following describes how to set up the build time environment:

  1. Go to File -> New -> Project,
  2. Choose Java Project and click Next,
  3. Enter a value in the Project name field (you can use the name of the use case for example, such as CAAENOPosAppBinderAxis1_3Client) and click Next,
  4. On the Java Settings window, point to the Libraries tabpage,
  5. Click on Add External JARs and browse to the directory where you unzipped the Axis binary release,
  6. Point to the \axis-1_3\lib subfolder. Select the following JARs using CTRL + Click and then click on Open: axis.jar, axis-schema.jar, commons-discovery-0.2.jar, commons-logging-1.0.4.jar, jaxrpc.jar, saaj.jar and wsdl4j-1.5.1.jar,
  7. Click on Add External JARs again and browse to the directory where you unzipped the Xerces binary release,,
  8. Point to the \xerces-2_6_2\ folder. Select the following JARs using CTRL + Click and then click on Open: xml-apis.jar, xmlParserAPIs.jar and xercesImpl.jar,
  9. Select the existing JRE System Library entry and click Remove,
  10. Click on Add Library, select JRE System Library then click Next,
  11. Click on Installed JREs, then Add,
  12. Select Browse... next to the JRE home directory field and point to your Java 1.3 installation,
  13. In the JRE name field enter jdk1.3.1 or any name you wish to use then click OK,
  14. Click OK to close the Installed Java Runtime Environments window,
  15. Select the newly created name entry (jdk1.3.1_08) from the Alternate JRE drop-down list,
  16. Click Finish to close the JRE System Library window,
  17. Click Finish to close the New Project wizard.

[Top]

Building the Use Case Code Samples

CAA Web service use cases that demonstrate how to consume CAA Web services using Axis generally include:

For the CAAENOPosAppBinderImplAxis1_3Client use case being demonstrated, you can import these resources as described below:

  1. On the Package view, right click on the src source folder and go to Import,
  2. Choose File system and browse to the \CAAPLMSecurity.edu\CAAENOPosAppBinderImplAxis1_3Client.mj\src folder described in [1],
  3. Check the src folder icon that appears on the left pane. It automatically checks all the subfolders and classes available,
  4. Click Finish to close the Import wizard.

ENOVIA LCA V5 CAA Web services rely on a custom class that must be written in order to maintain the HTTP session state with Axis [3]. This class is provided for convenience and can be added to your project using the following steps:

  1. Right click on the src source folder again and go to Import,
  2. Choose File system and browse to the \CAAWebServices.edu\CAAJAXRPCHTTPSessionHandler.mj\src folder described in [3],
  3. Check the src folder icon that appears on the left pane. It automatically checks all the subfolders and classes available,
  4. Click Finish to close the Import wizard.

Several CAA Web services may be used in combination of others. In such context, you will need to import resources from different use case modules before building and launching a given use case scenario. Please refer to the use case that describes how to consume the CAA Web service you wish to use for a complete list of such dependencies. You may then repeat the steps numbered from 1 to 4 above as many times as necessary.

By default, IRAD 6.0 is set on Build Automatically (Project menu). You should see no build errors in the Problems view.

If using the default Java environment from IRAD 6.0, your Java project should look as the following for the CAAENOPosAppBinderImplAxis1_3Client use case demonstrated as example:

Fig.1: Using Java 1.4
 
Using Java 1.4

[Top]

Launching a Use Case Scenario

CAA Web service use cases that demonstrate how to consume CAA Web services using Axis generally contains one or more CAAXXXClient classes. You should just replace XXX by the actual name of the class you want to launch. Each class is intended to provide a sample usage scenario for the CAA Web services being demonstrated. They can be launched using either a JRE or any Java IDE from the market. When using a JRE, please make sure to set your CLASSPATH so that it includes all of the required dependencies.

The following describes how to launch a use case scenario from within IRAD 6.0. These steps could be performed in the almost exact same way when using IBM WSAD (WebSphere Studio Application Developer) 5.1.x or Eclipse 3.x:

  1. Select the project from the Package Explorer view (for example CAAENOPosAppBinderAxis1_3Client),
  2. Select the Run menu, then point to Run again,
  3. From the Main tabpage, choose Java Application then click on New,
  4. Give a new name to the configuration using the Name field (such as CAAENOPosAppBinderAxis1_3Client),
  5. Make sure that the right project is selected in the Project field, and then click on Search in the Main class area,
  6. Select the CAAXXXClient class (for example, CAAENOPosApplicationBinderImplClient) and click OK,
  7. From the Arguments tabpage, enter the required arguments as described in the related use case article:
    Example: -w http://karindsy.dsy.ds:9080/B17 -e cjk -u wpsadmin -p wpsadmin,
  8. Click on Apply then Run.

The output is displayed in the Console view within IRAD 6.0. A sample result is given for the CAAENOPosAppBinderAxis1_3Client use case demonstrated. Running the client in your own environment will most likely produce different results. In any case, the last line should always inform that the test passed successfully:

================================================================================
Displaying inputs
================================================================================
Web application context root URI: http://karindsy.dsy.ds:9080/B17
ENOVIA LCA V5 P&O username: cjk
Basic authentication username: wpsadmin
Basic authentication password: wpsadmin
================================================================================
Running ENOPosApplicationBinderImpl CAA Web service use case
================================================================================
STEP 1: Instantiating and configuring CAA Web service proxy
Jan 26, 2006 5:57:54 PM org.apache.axis.utils.JavaUtils isAttachmentSupported
WARNING: Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
--------------------------------------------------------------------------------
STEP 2: Getting contexts for user specified
--------------------------------------------------------------------------------
>>> Invoking 'getUserContexts' on ENOPosApplicationBinderImpl CAA Web service proxy
Username: cjk
Reading 2 cookies from HTTP response
Cookie[0]: LtpaToken=mVD8PxR7VAh08zM+h9BOQ3px7/nnOpCi0cu2JSDBcvbyT5nKwMpMWMvKlHuaxo...
Cookie[1]: JSESSIONID=0000-JrFIo0KK4Lnz7YOMWuuYt-:-1
Storing cookies in memory. Client ID: 1138294673313
Status: Success
Found 1 context(s) in database
Displaying list of available contexts:
Context[0]: VPMADMIN.ADMIN.DEFAULT
--------------------------------------------------------------------------------
STEP 3: Logging on to ENOVIA LCA V5
--------------------------------------------------------------------------------
>>> Invoking 'bindToApplication' on ENOPosApplicationBinderImpl CAA Web service proxy
Using context: VPMADMIN.ADMIN.DEFAULT
Reading cookies from memory. Client ID: 1138294673313
Setting cookies on HTTP request: LtpaToken=mVD8PxR7VAh08zM+h9BOQ3px7/nnOpCi0cu2JSDBcvbyT5nKwMpMWMvKlHuaxo...; JSESSIONID=0000-JrFIo0KK4Lnz7YOMWuuYt-:-1
Status: Success

--------------------------------------------------------------------------------
STEP 4: Logging out from ENOVIA LCA V5
--------------------------------------------------------------------------------
>>> Invoking 'releaseFromApplication' on ENOPosApplicationBinderImpl CAA Web service proxy
Reading cookies from memory. Client ID: 1138294673313
Setting cookies on HTTP request: LtpaToken=mVD8PxR7VAh08zM+h9BOQ3px7/nnOpCi0cu2JSDBcvbyT5nKwMpMWMvKlHuaxo...; JSESSIONID=0000JrFIo0KK4Lnz7YOMWuuYt-:-1
Status: Success
================================================================================
Use case execution successful

[Top]


In Short

This use case describes how to set up a buildtime and runtime environment using IRAD 6 in order to compile and launch the CAA Web services use cases that rely on Axis.

[Top]


References

[1] Consuming the ENOPosApplicationBinderImpl CAA Web Service
[2] Generating a Java Client Binding
[3] Maintaining the Session State

History

Version: 1 [Apr 2005] Document created
Version: 1 [Jan 2006] Document updated
[Top]

Copyright © 1994-2006, Dassault Systèmes. All rights reserved.