My new website on Artificial Intelligence and Machine Learning www.aimlfront.com

TCP/IP Monitor

How do I monitor HTTP communication in Eclipse?

Eclipse has a TCP/IP Monitor view that comes in very handy if you're interested in watching the HTTP communication between a browser and your web application. Basically, it listens on a port on your machine where Eclipse is running, and it forwards that request on to a destination host and port. Tomcat typically runs on port 8080 when I fire up a project on my local machine, so I have the TCP/IP Monitor listen on port 8081 and forward the request to port 8080 of the localhost. By listening to 8081 and forwarding to 8080, the TCP/IP Monitor grabs and displays the requests going to the server and the responses coming back from the server. It can display headers, which can be very useful when trying to track down difficult issues with web application. It is also very useful if you ever need to do analyze something like SOAP communication.

Here gave example with Tomcat server, but whatever server, we can monitor services. For example that web service is not working locally also, we can connect webservice with SOAP request and SOAP response using authentication.

Once you have created your Web service and Web service client, you can monitor the Web service's SOAP traffic using the TCP/IP Monitor.

Prerequisites:

  1. Generate a Web service
  2. Generate a Proxy and a sample application

This is my target URL for service to monitor.

1. Application flow:

http://com.javavillage.services:4562/emailService

Application setup


2.  Application flow with TCP/IP monitor:

http://localhost:7777/emailService

Application with TCP IP Monitor

Actual URL: http://com.javavillage.services:4562/emailService
Monitor URL: http://localhost:7777/emailService

Here we are monitoring email service with port 7777. Instead of actual URL will use Monitor URL where we have given actual URL. Start the application and try to hit monitor URL. See Monitor URL will take request and will hit the actual URL. From Actual Service it will get the response. So Request and response transfer will be happening through TCP/IP Monitor. If you see TCP/IP monitor perspective we can see request and response.

See the procedure How to use?



If you have the Eclipse Web Tools, you should have the TCP/IP Monitor view, which can be found at Project Other TCP/IP Monitor

Select the TCP/IP Monitor view and clicked OK.

TCP IP monitor window in eclipse


Now we should add host name and port details in TCP/IP Monitor.

Local monitor port is 7777, this is dummy port to monitor service. This dummy port will point out actual service. So wherever we have given actual service details we should give dummy port and localhost as host name.

tcp ip monitor configure details

After that start the monitor.

tcp ip monitor server startup

Next check the 'Show View' option and then click 'TCP/IP Monitor'.

Eclipse view for TCP IP monitor

Use below link for to hit email service. Start application and hit email service with dummy port.

http://localhost:7777/emailService

This is the TCP/IP Monitor window. Here we can see request and response through TCP/IP Monitor.

TCP IP monitor results in eclipse


Tcp ip sample example