Introduction
In a common debugging excercise developers struggle to find out exactly what HTTP header or parameter values are submmitted to a web based application. Often the solution is to print the output of request.getParameter() calls.
The TCP/IP Monitor tool available in WSAD will help you view the HTTP request and response data flowing between a browser and any HTTP server. Developers will find it extremely useful tool.
How Does It Work?
The TCP/IP Monitor is a proxy server that sits between the web browser and the actual web server.
Steps to configure and use the TCP/IP Monitor are as follows:
- Create a TCP/IP Monitor server.
- Configure the server’s local and remote port.
- Start the TCP/IP Monitor server and the web server (which may be a WebSphere test server).
- Test the application.
Creating the TCP/IP Monitor Server
Launch WSAD. Switch to the Server perspective. In the Server Configuration view right click on Servers and select New->Server and Server Configuration.
Enter a name for the server and select TCP/IP Monitoring Server as the Server type.
Click on Finish.
Configuring Ports
You will need to determine the port being used by the web server. If you will be running your application in the WebSphere Test Environment, double click on the WebSphere server in the Server Configuration view, click on the Ports tab and look up the port to be used by the server in the Server Settings section.
In the above example, the port number is 8080. This will be the remote port for the TCP/IP Monitor.
Double click on the TCP/IP Monitor server you just created. Click on the Configuration tab. Enter the following values.
Local port: Any port that is not being used by any other server. (9081 in our case)
Remote host: The host name of the web server.
Remote port: The port being used by the web server.
Start the Servers
From the Servers view start the TCP/IP Monitor server (and the WebSphere server if you are running your application in that environment).
Test the Application
Right click on your application’s starting HTML/JSP or Servlet and select Run on Server. System will offer a choice to use the TCP/IP Monitor.
Select Web browser (via TCP/IP monitor) and click on Finish. System will launch the browser and issue the URL request using the local port. If you are testing an application that is not a WSAD project, you can manually enter the URL with the local port number.
System will automatically open the TCP/IP Monitor view. If it doesn’t open, you can open it by selecting Window->Show view->Other and then Server->TCP/IP Monitor.
Select a URL and view the HTTP request and response associated with the URL.