MTOM service - Configure and run


Configuring the Sample
Running the Sample

There are two Message Transmission Optomization Mechanism (MTOM) service clients, a command-line version that uses the Java archive (JAR) file for the Thin Client for JAX-WS with WebSphere Application Server, and a servlet version that uses a JavaServer pages (JSP) to access the MTOM service.

Sample service endpoints
URI Description
http://localhost:9080/WSSampleMTOM/MtomSampleService
MTOM service Sample using SOAP 1.1
http://localhost:9080/WSSampleMTOM/MtomSampleService12
MTOM service Sample using SOAP 1.2

Port 9080 is the default value, but the port number is different if you install to a profile other than the AppSrv01 profile.



Configuring the Sample

To complete the configuration of this Sample, deploy the JAX-WS Web services Sample application on the server. If the sample application is not already deployed, see the instructions for Rebuilding and deploying the JaxWSServicesSamples.ear file.

Running the Sample

Before you begin, you must verify that the application server is running before running the clients.

The MTOM service Sample consists of two clients and a single enterprise bean deployed on the server. One client is a command-line version that uses the Thin Client for JAX-WS with WebSphere Application Server JAR file. The other client is a servlet version that uses a JSP file to access the MTOM service.

Running the MTOM service servlet
Running the MTOM service thin client application

MTOM service clients

The MTOM service clients send a file encoded with MTOM to the specified service endpoint. By default, the host is set to local host, but you can change this value. A file name is required and there is no default provided. In this Sample, the service receives the file sent from the client, and then the file is returned to the client in the dispatch or proxy programming model as specified.

Running the MTOM service servlet client

The MTOM service servlet client is not container managed.

For more information about invoking a servlet client in a Thin Client for JAX-WS environment, see the documentation on running an unmanaged Web services JAX-WS client in the WebSphere Application Server Information Center Library.

To run the simple MTOM servlet service client from WebSphere Application Server, perform the following steps:

  1. Start the server.
  2. Click Run.

Running the MTOM service thin client application

The WSSampleMTOMClient.jar file is a command-line version of the MTOM service thin client application.

In the following steps, the variable, app_server_root, refers to the application server installation root directory.

To run the MTOM service thin Client application from WebSphere Application Server, perform the following steps, based on your operating system:

  1. Start the server.
  2. Open a command prompt.
  3. Go to the JaxWSServicesSamples directory.

    On Windows operating systems:

    cd app_server_root\samples\bin\JaxWSServicesSamples

    On operating systems such as AIX, Linux, and z/OS:

    cd app_server_root/samples/bin/JaxWSServicesSamples

    On iSeries operating systems:

    cd app_server_root/samples/bin/JaxWSServicesSamples

  4. Run the MTOM service Sample.

    On Windows operating systems:

    runSampleMtom.bat -i filename -h hostname -p port -f urlSuffix -d -x -1 -2

    On operating systems such as AIX, Linux, and z/OS:

    ./runSampleMtom.sh -i filename -h hostname -p port -f urlSuffix -d -x -1 -2

    On iSeries operating systems:

    ./runSampleMtom -i filename -h hostname -p port -f urlsuffix -d -x -1 -2

    The parameters are:
    -i <filename> is the name of the file to send. This is a required parameter and no default value is provided.
    -h <hostname> is the name of the host. The default is localhost.
    -p <port> is the port number. The default is 9080.
    -f <urlsuffix> the service endpoint context. The default is /WSSampleMTOM/MtomSampleService.
    -d specifies to use the dispatch model only.
    -x specifies to use the proxy model only.
    -1 specifies to use SOAP 1.1. This is the default.
    -2 specifies to use SOAP 1.2.

    The following example illustrates a successful run of the MTOM service thin client application on the Windows operating system:

    runSampleMtom.bat -i c:\SYSLEVEL.IBM -p 9081
    >>---------------------------------------
    >>MTOM Dispatch Test
    >>MTOM Loading data from: 'file:/c:/SYSLEVEL.IBM'
    Aug 10, 2007 12:11:49 PM com.ibm.ws.ssl.config.SSLConfigManager
    INFO: ssl.disable.url.hostname.verification.CWPKI0027I
    >>MTOM Invoking Dispatch with a binary payload
    >>MTOM Response received
    >>MTOM Writing returned image to dispatch_response.gif
    >>MTOM Dispatch Done
    >>---------------------------------------
    >>MTOM Proxy Test
    >>MTOM Invoking proxy with a binary payload
    >>MTOM Response received
    >>MTOM Writing returned image to proxy_response.gif
    >>MTOM Proxy Done

To learn more about how the client and the application works, see the MTOM service technotes or view the Java source code.