Creating WebSphere Application Server applications

In this task, you create WebSphere Application Server applications that implement interaction patterns. The applications include the following types of projects:

In addition to WebSphere Application Server components (EJBs and MDBs), the tooling generates the following helper classes:

After you have created the projects, you can export an individual interaction pattern as an Enterprise Application Archive application for deployment on a WebSphere Application Server, or you can include multiple interaction patterns in a single Enterprise Application Archive application for deployment.

Note:
The final Enterprise Application Archive project must include a a helper file, boutils.jar, that contains the business object initialization library routine. You must add this file to the completed Enterprise Application Archive by importing it manually, as described under Adding the Business Object Library Routine, later in this section.

The topics in this section describe how to create for each interaction pattern.

Agent Delivery (Asynchronous Event Delivery)

The Agent Delivery interaction pattern asynchronously delivers a message from the adapter to WebSphere Application Server. No response message is required from WebSphere Application Server.

To create an Agent Delivery interaction pattern, you must create an Enterprise Application Archive application that contains:

The Enterprise Application Archive application must also contain .wsdl and .xsd files from the Service Project. If you chose Export to Service Project when you deployed your System Manager user project, the Service Project already exists and is included in the Enterprise Application Archive. If you instead exported your System Manager user project as individual files to a directory or as a JAR file, you will need to import the file or files into a new Service Project.

Import files for a new service project

This step is not necessary if you exported your System Manager user project directly into an existing service project, as described in Deploying user projects. If you exported from System Manager to a JAR file or to a directory, you will need to perform this step to import the files into a service project. This step creates a Session Bean and .wsdl files that describe it.

This procedure assumes that in System Manager you chose the option to Export to a Directory. To import the exported files into a new service project, do the following:

  1. In the Business Integration perspective, choose File>New>Service Project.
  2. The New Service Project dialog displays. Enter a name that you want to use for this project, accept the default for Project contents, and click Next.

  3. Click Finish. The new service project is created in your default workspace. The core libraries, and any additional elements that you included from existing projects, are displayed in the Package Explorer view of the Business Integration perspective.
  4. In the Package Explorer view, right-click on the new service project you have created, and choose Import.
  5. The Import dialog displays. Select the File System folder and click Next.

  6. In the Directory scroll box, browse to the folder that contains the .wsdl files and .xsd files that you have created for use in this interaction pattern. If you created the .xsd files and .wsdl files for this interaction by deploying a user project from System Manager, you should have a folder with the same name that you gave the user project. Choose that folder, and click OK.
  7. The Import dialog now displays the files contained within the project folder that you have selected. Checkboxes enable you to include or exclude specific .xsd or .wsdl files. Your default choice, assuming that the user project that you created in System Manager contains only elements that are usable in the interaction pattern that you are creating, should be to include all the .xsd and .wsdl files displayed in the folder. However, the dialog enables you to select any or all of the files. Typically you should have all of the business object .xsd files that you designated as supported in the connector configuration in the same folder with the WSDL file that was created from the connector's configuration file. Error messages may be displayed if the .xsd files for any supported business objects are missing from the folder that contains the WSDL file.

  8. Specify the name of the destination folder for the files that you are importing; for example, MyServices\com\ibm\cw
  9. Click Finish.
  10. In Package Explorer, the files that you imported are displayed under the service project that you named.

Create an EJB

The Agent Delivery interaction pattern requires an EJB to consume the message incoming to WebSphere Application Server from the agent. You must both create the EJB and add business logic to the EBJ method to process the received event.

Start by creating a project that will contain the EJB:

  1. In the J2EE view of the Business Integration perspective, choose File>New>Project.
  2. In the New Project dialog, choose EJB in the left-hand panel, then select EJB project in the right-hand panel, and then choose Next.

  3. In the Select an EJB Version dialog, choose Create 2.0 EJB Project, and click Next.

  4. In the EJB Project Creation Dialog, provide a name for your EJB project, and the name of a new or existing Enterprise Application Archive project folder to which it will be added. If you specify a name for a new Enterprise Application Archive project, a folder with that project name will be created.

  5. Choose Finish. A project, containing an EJB module, is generated under the name that you specified. The EJB project is created for you and you can see it in the J2EE Hierarchy view under EJB Modules. In the Services view, under Service Projects, select the .wsdl interface file that you imported from your connector configuration (for example, AgentDelConnector.wsdl). Right click, and choose New>Build from Service. The New Service Skeleton dialog opens.
  6. Choose EJB Service Skeleton and click Next.

  7. In the New Service Skeleton dialog, select Create a new port and binding and select Generate helper classes. Choose Next.
  8. The Service Skeleton dialog appears.

  9. Select the appropriate Port type name according to the interaction pattern you are creating, and provide a meaningful package name in place of the default. Click Next.
  10. In the next dialog, you can specify properties for generating the EJB skeleton, or accept the defaults. Click Finish. The newly created EJB project will be listed under Deployable Services in the Services view.
  11. Edit the skeleton to add any necessary business logic.

Create an MDB

A message driver bean is responsible for receiving events as messages from the connector and invoking EJB processing of the events.

In this step, you will deploy the EJB service to the server using existing inbound port and bindings - the original JMS bindings. This step generates an MDB that invokes the appropriate method of the Session Bean skeleton. The MDB is specific to the port type and the selection of the operation is made based on the incoming message properties: WSDLOperation (and possibly WSDLInput and WSDLOutput) properties. The additional helper classes, format handlers, are also generated during the deployment. These are used to convert from the wire format (the XML message) to the Java Class, which in turn is passed as an argument to the business method of the EJB.

You must configure the JNDI names used by the EJB and MDB. The JNDI setup is necessary since the lookup names of the queue connection factory and queues defined in WSDL may not match the actual names defined on your server. The WebSphere Application Server allows you to map the name you are looking up (as specified in WSDL) to the actual JNDI name deployed on the server, thus allowing correct execution without the need for modification of your wsdl files. You also need to specify what listener port is used by the MDB.

  1. In the Package Explorer view, expand the folder for the Service Project that you have created and select the EJBService .wsdl file that was generated in the previous task. Right-click on the file, and in the pop-up choose Enterprise Services>Generate Deploy Code.

  2. In the Generate Deploy Code dialog, select Use an existing port, and choose Next

  3. In the Inbound Service Files dialog, select the JMSService .wsdl file for your project, and the corresponding service name and port name. Choose Finish.
  4. In the J2EE Hierarchy view, select your project under EJB Modules, right-click, choose Open With the EJB Deployment Descriptor editor and choose the Bean tab. Verify that the Destination type is Queue. Specify the correct ListenerPort, so that its queue connection factory and queue match those specified in the .wsdl file for this interaction pattern.

  5. Choose the References tab. Select the resource queue name listed under the MDB. The name from the .wsdl file then appears in the Name box at right. Under WebSphere Bindings,in the JNDI name field, enter the correct JNDI name for the deployment of this queue, as defined in the WebSphere Application Server Administrative Console.

  6. Select the connector factory listed under the MDB. Under WebSphere Bindings, in the JNDI name field, enter the correct JNDI name for the deployment of this connection factory, as defined in the WebSphere Application Server Administrative Console.

  7. Save the changes that you made in the EJB Deployment Descriptor editor.
  8. Open the Server Configuration tab in the lower panel of the Business Integration perspective and right-click on the Servers icon.
  9. Choose New, and choose Servers and Server Configuration. The Create a New Server and Server Configuration dialog appears.


  10. In the Server name field, enter a name for the server instance you are creating. Enter the same name in the Folderfield. In the Server Type field, select EE Test Environment.
  11. Choose Finish, and respond Yes when prompted to create a new server project with the name you specified.
  12. After the utility completes, in the Server Configuration panel double-click the icon for the new server instance that you have created. The WebSphere Server panel appears, with the name of the server instance you have created. Choose the Configuration tab.
  13. The WebSphere Server Configuration panel appears. Put a check in the Enable administration console check boxes.

  14. Choose the Variables tab. In the Defined variables drop down box, locate the MQ_INSTALL_ROOT variable. Change the value of the variable to the absolute root path of your MQ installation.
  15. Save your configuration. (Ctrl+S).
  16. Start the newly configured server instances, as follows: In the lower portion of the Business Integration perspective, choose the Servers tab. The Servers panel displays. In the Servers panel, select the icon for the newly configured server instance, and click the run button to start the server.
  17. Open the WebSphere Application Server Administrative Console. Under General Properties under the Configuration tab, add the listener port name that you specified in the Bean tab of EJB Deployment Descriptor. Add the same connection factory JNDI value and destination JNDI queue name value that you specified in the References tab of EJB Deployment Descriptor. As appropriate for your needs, make any necessary changes in the Maximum sessions, Maximum retries, and Maximum messages fields.

  18. In the WebSphere Application Server Administrative Console, add the queue as a resource. Provide a display name for the queue and a JNDI lookup name. The JNDI lookup name must be the same as specified for the EJB Deployment Descriptor and the listener port.

    In the Base Queue Name field, enter the name of the physical queue that you created in the MQ queue manager. This must correspond to the DeliveryQueue that you specified in the connector configuration properties using Connector Configurator.

    In the JNDI Name field, enter the name of the queue that you established in the destination JNDI queue name value in the Bean tab of EJB Deployment Descriptor. Provide a value for Base Queue Manager Name.
  19. Create a queue connection factory, with the JNDI name corresponding to the name used in the EJB Deployment Descriptor and in the listener port.

After you have completed these steps, you will have a completed Enterprise Application Archive application for this interaction pattern. You can then test this Enterprise Application Archive application in the EE Test Environment and deploy the application as an Enterprise Application Archive file to another WebSphere Application Server environment.

Copyright IBM Corp. 1997, 2004