First of all, the servlet code must be packaged into a form that suits the application server. This example will create a web module for use with WAS 4.0.
From the WebSphere Administrative Console, choose the menu item Application Assembly tool from the Tools menu. The Application assembly tool should appear.
Figure 97. The WebSphere administrative console
Select "Create Web Module Wizard", and click OK. In specifying the properties, enter the file name, and more information, if you wish.
Figure 98. Specifying Web module properties
Figure 99. Adding files to the application
The next step is to add files to the application. The examples.trace.MQeTraceServlet is in the MQeExamples.jar and relies on classes from MQeGateway.jar, MQeExamples.jar and MQeTraceDecode.jar.
Since you've included all the classes you need, the next panel that asks you if you want to make distributable, or set a classpath, can be left blank, just click next. The next panel is to set any icons for this web application. If you don't have any, just click next.
Next you have to specify the component properties.
Figure 100. Adding web comopnents
Only the component name is compulsory, but you may want to add a display name and a description.
The next panel allows you to specify which class is the servlet to run.
Figure 101. Specifying component type and class name
The next four panels can safely be left blank, they are for specifying icons, security roles and initialization parameters.
After this, you must specify what URL will map to your servlet. The final URL will be of the form http://hostname:port/specified_dir/specified_url_pattern
Figure 102. Specifying a URL to map to your servlet
All of the subsequent panels can be left blank. They are for adding resources, context parameters, error pages, MIME mappings, tag libraries, welcome files and EJB references.
Click Finish, and then save the file. If you save the file to \AppServer\InstallableApps\ where you installed WebSphere application server, then it will automatically appear in the list of servlets in the administration panel.
Next, this component needs to be imported and started. From the wizards button, select "Install Enterprise Application".
Figure 104. Install enterprise application
Install your component as a standalone module.
Figure 105. Installing your component as a standalone module
Specify an application name, and a root for the web module. This is the part of the URL immediately after the http://hostname:portnumber/ and shouldn't be left as /
Figure 106. Specifying an applilcation name
All of the subsequent panels can be left blank, they are about controlling users, EJB roles, JNDI bindings, EJB mappings, resource references, datasources for EJB, data sources for CMP, and virtual hosts.
Figure 107. Information dialog
Next, the web module has to be started. Select the application server that it has been configured for. It should appear under Installed Web Modules.
Figure 108. Starting the web module
Figure 109. Information dialog success message
If everything went well, it should now be available for use from the com.ibm.mqe.trace.MQeTraceToBinaryMidp. Since this servlet doesn't support get, then viewing the URL with a web browser will result in a 405 error. This is normal.
If your application server is set up with the defaults, the URL for the servlet is http://localhost:9080/mqetrace/trace.