Trace SOAP message Using Eclipse IDE

Trace SOAP message Using Eclipse IDE explains step by step details of How to debugging web service using Eclipse IDE.

By using Eclipse TCP/IP monitor, we can check the data flowing through TCP network. TCP/IP monitor placed intermediate to a consumer and a server. The consumer is made to contact with TCP/IP monitor, and it further send the data to the server and will shows on in its Graphical User Interface(GUI).

For example if you, created webservice is deployed using Apache CXF or Apache AXIS, you can able to monitor traffic on TCP connections by using this tool  

Note

1) If you need JAX-WS example, You can follow Trace SOAP request/response using JAX-WS

2) If you need tcpmon example, You can follow TCPMon Tutorial

Required Libraries

You need to download

  1. JDK 6
  2. Eclipse 3.7

Thinking that webservice is already up and is available on the port 8080 (My server is Tomcat, So Tomcat default port). If not, please check this article CXF Web Service Tutorial

Configure Eclipse TCP/IP Monitor

First you need to enable TCP/IP monitor (see the screenshot) in Eclipse IDE (Windows –> Preferences –> Run/Debug –> TCP/IP Monitor), then click Add button in the left side menu.

Trace SOAP message Using Eclipse IDE

Steps (Please see the following screen shot)

  1. Set Listen Port # as 8081 ( Assuming that port 8081 is free on your system )
  2. Leave Target Hostname as 127.0.0.1
  3. Set Target Port # as 8080

Trace SOAP message Using Eclipse IDE

Now click the OK button and then click the Start button on the left side menu. For monitoring the request/response we need to invoke the service. So just run the following client for simulating.

Note

Please check that client is calling listening port (8081) and not Tomcat port where web service is running (8080)

Simulate Eclipse TCP/IP Monitor

package com.client;

import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;

import com.student.ChangeStudentDetails;
import com.student.Student;

// Monitor SOAP Message using Eclipse IDE

public class StudentClient {

public static void main(String args[]) throws Exception {

JaxWsProxyFactoryBean factoryBean = new JaxWsProxyFactoryBean();

      factoryBean.getInInterceptors
().add(new LoggingInInterceptor());
      factoryBean.getOutInterceptors
().add(new LoggingOutInterceptor());
      factoryBean.setServiceClass
(ChangeStudentDetails.class);
      factoryBean.setAddress
("http://localhost:8081/CXFTutorial/services/ChangeStudent?wsdl");
      ChangeStudentDetails client =
(ChangeStudentDetails) factoryBean.create();
      Student student =
new Student();
      student.setName
("Rockey");
      Student changeName = client.changeName
(student);
      System.out.println
("Server response: " + changeName.getName());
}

}

Running Eclipse TCP/IP Monitor

Trace SOAP message Using Eclipse IDE









Your email address will not be published. Required fields are marked *