1. tcpmon

This section describes the tcpmon tool.

1.1. Execution

The tcpmon tool checks the TCP packets being exchanged. Use tcpmon when searching for HTTP SOAP messages.

The following describes the two modes that tcpmon runs in.

Mode Description

Listener

Listener receives a request from the listener port and sends the request to the specified target host and target port. The listener then receives a response from the host and sends the response to the connections from which the request originated.

Proxy

Sets tcpmon to operate like an HTTP Proxy.

The following screen appears after tcpmon is executed.

$ tcpmon
figure webservice tools tcpmon
tcpmon execution screen

1.2. Using the Listener Mode

The following should be assumed when using the listener mode.

  • Server (A) receives a SOAP request from port 8000.

  • The web service client of client (B) is trying to monitor SOAP messages.

figure webservice tools listenermode1
Scenario in which server (A) receives a SOAP request from port 8000

In this scenario, the client web service program can use tcpmon to monitor SOAP messages.

Execute tcpmon in client (B), and execute the following.

  1. In the [Admin] tab, set 'Listen Port' to '9000' and 'Act as a' to 'Listener'. Under 'Listener', set 'Target Hostname' to 'A' and 'Target Port' to '8000'. Click [Add].

    figure webservice tools listenermode2
    Listener mode input screen
  2. The [Port 9000] tab is created. If this tab is clicked, the following screen appears.

    figure webservice tools listenermode3
    Monitoring screen

    The following table describes the check box and the buttons on the screen.

    Item Description

    XML Format

    Arranges and outputs XML onto the tcpmon screen.

    [Save]

    Saves the current SOAP messages.

    [Resend]

    Resends the current SOAP message request.

    [Switch Layout]

    Changes the screen into the horizontal or vertical split mode.

  3. After completing the first two steps, connect the client program to port 9000 of client (B), not port 8000 of server (A), and execute the client program. tcpmon receives a request from port 9000 and transmits it to port 8000 of server (A). tcpmon returns the response to the connection used by the client to connect to tcpmon. The response messages are then outputted to tcpmon.

    figure webservice tools listenermode4
    tcpmon receives a query through port 9000, and transmits it to port 8000 in A
Changing the End-Point Address of a Web Service

To use the tcpmon in the listener mode, the client or client program settings must be modified to change the end-point address of the web service.

  • For the J2SE JAX-WS web service client

    Modify the code to change the end-point address of the web service.

    (jakarta.xml.ws.BindingProvider)port).getRequestContext().put(
        jakarta.xml.ws.BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
        "http://localhost:9000/ws/AddNumbersService");
    • port

      JAX-WS BindingProvider object for service end-point interfaces.

    • jakarta.xml.ws.BindingProvider.ENDPOINT_ADDRESS_PROPERTY

      Standard properties defined in the JAX-WS specification for setting the end point address.

  • For the J2SE JAX-RPC web service client

    Modify the code to change the end-point address of the web service.

    ((javax.xml.rpc.Stub)port)._setProperty(
          javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY,
          “http://localhost:9000/ws/AddressBookService”);
    • port

      JAX-RPC Stub object for service end-point interfaces.

    • javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY

      Standard properties defined in the JAX-RPC specification for setting the end-point address.

  • For the J2EE web service client

    The previous properties can be applied to the JEUS configuration file (jeus-web-dd.xml or jeus-ejb-dd.xml) by adding the <stub-property> block inside the <service-client> block, without modifying the code.

    <service-client>
        <port-info>
            <stub-property>
                <name>javax.xml.rpc.service.endpoint.address</name>
                <value>
                    http://localhost:9000/ws/AddressBookService
                </value>
            </stub-property>
        </port-info>
    </service-client>

1.3. Using the Proxy Mode

The proxy mode sets tcpmon to operate like a regular HTTP Proxy. The proxy mode can be enabled in the [Admin] tab by first setting the 'Listen Port' field, then selecting 'Act as a' for Proxy, and finally clicking the [Add] button.

In proxy mode, tcpmon can be used by providing options when executing an application instead of modifying the application. The following describes the options available in proxy mode.

Option Description

-Dhttp.proxyHost

IP address or hostname where TCPMON runs.

-Dhttp.proxyPort

TCPMON listener port.

If the client application is the com.acme.AddressBookClient class, execute Java with the following option.

java –Dhttp.proxyHost=B –Dhttp.proxyPort=9000 com.acme.AddressBookClient

1.4. Other Features

SOAP messages can be formatted, saved, and re-transmitted in each port tab.