Ping and Echo - Configure


Running the Sample
Running the thin client Sample
Enabling Reliable Messaging and Security

The Ping and Echo Samples are two simple JAX-WS Web services.

The Ping Sample demonstrates a one-way operation. A simple string value is passed to the service. The client operation is complete after it has contacted the service. Two endpoints exist in the Sample. One endpoint uses SOAP 1.1 and the other endpoint uses SOAP 1.2.

The Echo Sample demonstrates a two-way operation. A simple string value is passed to the service. The service prepends an identifier string value and returns this value back to the client. There are two endpoints in the Sample. One endpoint uses SOAP 1.1 and the other endpoint uses SOAP 1.2. The Echo Sample also demonstrates the synchronous and asynchronous programming models, as well as synchronous and asynchronous over-the-wire behavior:


Sample service endpoints
URI Description
http://localhost:9080/WSSampleSei/PingService
Ping service sample using SOAP 1.1
http://localhost:9080/WSSampleSei/PingService12
Ping service sample using SOAP 1.2
http://localhost:9080/WSSampleSei/EchoService
Echo service sample using SOAP 1.1
http://localhost:9080/WSSampleSei/EchoService12
Echo service sample using SOAP 1.2

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



Configuring the Sample

To complete the configuration of the Ping and Echo Sample, deploy the Jax-WS Web Services Sample application on the server. If the sample application is not already deployed, refer to 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 Ping and Echo Sample includes two services, Ping and Echo.

Running the Ping and Echo Sample

The Ping Sample demonstrates a one-way service transaction. The source for this Sample is located in the profile_root/samples/src/JaxWSServicesSamples/SampleClientSei directory.

The Echo Sample demonstrates a two-way service transaction. The source for this Sample is located in the profile_root/samples/src/JaxWSServicesSamples/SampleClientSei directory.

To run the Ping and Echo client servlet from a WebSphere Application Server, perform the following steps:

  1. Start the server.
  2. Click Run.

Running the Ping and Echo thin client Sample

The Ping and Echo thin client Sample is similar to the Ping and Echo client servlet. This Sample accesses the same Ping and Echo Web services beans, but it uses a Java archive (JAR) file that requires the Thin Client for JAX-WS with WebSphere Application JAR file in the class path.

You can find the WSSampleClientSei.jar file in the samples/lib/JaxWSServicesSamples directory.

The Ping and Echo thin client Sample creates a JAX-WS proxy for the Ping or Echo Web service based on the parameters that you provide. The proxy then contacts the service endpoint with the message. The Echo Sample waits for the response.

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

To run the Ping and Echo thin client from a 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 Ping and Echo thin client Sample.

    On Windows operating systems:

    runSampleSei.bat -h hostname -p port -f urlSuffix -m testMessage -s service -t timeout -w asyncwire -c count -1 -2

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

    ./runSampleSei.sh -h hostname -p port -f urlSuffix -m testMessage -s service -t timeout -w asyncwire -c count -1 -2

    On iSeries operating systems:

    ./runSampleSei -h hostname -p port -f urlsuffix -m testMessage -s service -t timeout -w asyncwire -c count -1 -2

    The parameters are:
    -h <hostname> is the name of the host. The default is localhost.
    -p <port> is the port number. The default value is 9080.
    -f <urlsuffix> the service endpoint context. The default is /WSSampleSei/EchoService.
    -m <message> the text of the message. The default is hello. If the message contains blanks, use quotes around the message.
    -c count specifies the number of transactions to run. The default is 1.
    -1 specifies to use SOAP 1.1. The default is SOAP 1.1.
    -2 specifies to use SOAP 1.2.

    The following example illustrates a successful run of the Ping and Echo client on the Windows operating system:


    runSampleSei.bat -p 9081
    Aug 8, 2007 7:01:00 PM com.ibm.ws.ssl.config.SSLConfigManager
    INFO: ssl.disable.url.hostname.verification.CWPKI0027I
    >> CLIENT: SEI Async to http://localhost:9081/WSSampleSei/EchoService
    [WAShttpAsyncResponseListener] listening on port 4733
    >> CLIENT: SEI Async invocation complete.
    >> CLIENT: SEI Async response is: JAX-WS==>>HELLO


To learn more about how the Sample client and application works, see the Ping and Echo technotes or view the Java source code.

For more information about Web Services clients, see the documentation on developing and deploying Web Services clients in the WebSphere Application Server Information Center Library.

Enabling Reliable Messaging & Security

Policy Set Scripts
Applying QoS to the Ping and Echo thin client Sample

Policy Set Scripts

Policy sets are used to enable quality of service (QoS) such as ReliableMessaging and SecureConversation. Policy sets that are attached to an application define the quality of service for that application. A set of scripts are provided to enable the policy sets for WS-ReliableMessaging (WS-RM), WS-SecureConversation (WS-SC) and WS-I Reliable Secure Profile (RSP). RSP is a composition of both WS-RM and WS-SC. These scripts are provided as examples. You can also enable Policy sets using the administrative console. These scripts are designed to work with the Sample applications only. The following tables describe the Policy set sample scripts.

Scripts for the Windows operating system
Filename Description
enableRMQoS.bat Enable WS-ReliableMessaging Version 1.1
enableRM1QoS.bat Enable WS-ReliableMessaging Version 1.0
enableSCQoS.bat Enable WS-SecureConversation
enableRSPQoS.bat Enable WS-ReliableMessaging and WS-SecureConversation
enableWSAQoS.bat Enable WS-Addressing
disableRMQoS.bat Disable WS-ReliableMessaging Version 1.1
disableRM1QoS.bat Disable WS-ReliableMessaging Version 1.0
disableSCQoS.bat Disable WS-SecureConversation
disableRSPQoS.bat Disable WS-ReliableMessaging and WS-SecureConversation
disableWSAQoS.bat Disable WS-Addressing

Scripts for operating systems such as AIX, Linux, and z/OS
Filename Description
enableRMQoS.sh Enable WS-ReliableMessaging Version 1.1
enableRM1QoS.sh Enable WS-ReliableMessaging Version 1.0
enableSCQoS.sh Enable WS-SecureConversation
enableRSPQoS.sh Enable WS-ReliableMessaging and WS-SecureConversation
enableWSAQoS.sh Enable WS-Addressing
disableRMQoS.sh Disable WS-ReliableMessaging Version 1.1
disableRM1QoS.sh Disable WS-ReliableMessaging Version 1.0
disableSCQoS.sh Disable WS-SecureConversation
disableRSPQoS.sh Disable WS-ReliableMessaging and WS-SecureConversation
disableWSAQoS.sh Disable WS-Addressing

Scripts for the i5/OS operating system
Filename Description
enableRMQoS Enable WS-ReliableMessaging Version 1.1
enableRM1QoS Enable WS-ReliableMessaging Version 1.0
enableSCQoS Enable WS-SecureConversation
enableRSPQoS Enable WS-ReliableMessaging and WS-SecureConversation
enableWSAQoS Enable WS-Addressing
disableRMQoS Disable WS-ReliableMessaging Version 1.1
disableRM1QoS Disable WS-ReliableMessaging Version 1.0
disableSCQoS Disable WS-SecureConversation
disableRSPQoS Disable WS-ReliableMessaging and WS-SecureConversation
disableWSAQoS Disable WS-Addressing


Use the following steps to run the reliable messaging scripts on the Windows operating system. You can run the all of the scripts in a similar manner based on your operating system.

  1. Open a command prompt using the Start Menu: Click Start-> Run. Enter cmd.
  2. Change to the app_server_root/samples/bin/JaxWSServicesSamples directory. For example: cd C:/Program Files/IBM/WebSphere/AppServer/samples/bin/JaxWSServiceSamples
  3. Run the reliable messaging scripts.
  4. (Optional) Specify your profile, cell, node or server name when you run the reliable messaging or security scripts. The enable and disable scripts for reliable messaging and the security have four optional parameters:

    The following example demonstrates how to run the Enable WS-ReliableMessaging script with the optional profile, cell, and node parameters specified:

    enableRMQoS.bat AppSrv02 MyServerNode01Cell MyServerNode01

    The following example demonstrates how to run the Disable WS-ReliableMessaging script with the optional profile, cell, and node parameters specified:

    disableRMQoS.bat AppSrv02 MyServerNode01Cell MyServerNode01

  5. Configure additional parameters on the command line as needed. If your server has administrative security enabled, then you must provide the user ID and password or the script fails, for example:
    ./enableRMQoS.sh -user myuserid -password mypassword
  6. Ensure the Sample applications start correctly. If you receive a warning message, the Sample applications might have started incorrectly. Use the administrative console to stop and then restart the Sample applications.  

Applying QoS to the Ping and Echo thin client Sample

To test the Ping and Echo thin client Sample with the QoS policy sets, follow these guidelines.
  1. Apply the quality of service (QoS) that you want to test to the Sample applications as indicated in the Policy Set Scripts section.
  2. Edit the runSampleSei script for your operating system.
  3. To add the WS-I RSP and SecureConversation policies, add the following statement to include the path to the Java Authentication and Authorization (JAAS) login file:

    On Windows operating systems:

    set JAASLOGIN=-Djava.security.auth.login.config=<profile_root>/properties/wsjaas_client.conf

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

    export JAASLOGIN=-Djava.security.auth.login.config=<profile_root>/properties/wsjaas_client.conf

    The profile_root indicates the server directory where your profile is located, for example:
    set JAASLOGIN=-Djava.security.auth.login.config=C:/IBM/WebSphere/profiles/AppSrv02/properties/wsjaas_client.conf

  4. Change the class path statement.

    On Windows operating systems:

    set CLASSPATH=%THIN_JAR%;./WSSampleClientSei.jar;.

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

    export CLASSPATH=${THIN_JAR}:./WSSampleClientSei.jar:.

    Note: The period (.) is included at the end of the class path statement. The period is included so the policy set loading code finds the META-INF directory. Do not omit the period.

  5. Add <JAASLOGIN> and -DUSER_INSTALL_ROOT="<profile_root>" to the Java command.

    On Windows operating systems:

    java %JAASLOGIN% -DUSER_INSTALL_ROOT= "<profile_root>" -cp "%CLASSPATH%" com.ibm.was.wssample.sei.cli.SampleClient %*

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

    java ${JAASLOGIN} -DUSER_INSTALL_ROOT="<profile_root>" -cp "${CLASSPATH} " com.ibm.was.wssample.sei.cli.SampleClient $@

  6. Create a directory named META-INF from the app_server_root/samples/bin/JaxWSServicesSamples directory.
  7. Copy the PolicySets directory from the profile_root/config/cells/CELL_NAME/ directory to the app_server_root/samples/bin/JaxWSServicesSamples/META-INF directory.
  8. Copy the bindings subdirectory and the clientPolicyAttachment.xml file from the profile_root/config/cells/ CELL_NAME/applications/JaxWSServicesSamples.ear/deployments/JaxWSServicesSamples/META-INF directory to the app_server_root/samples/bin/JaxWSServicesSamples/META-INF directory. Copy the entire bindings subdirectory and its contents, for example, SecureConversationClientBinding or RAMP_client_default_bindings.
  9. Change the current directory to app_server_root/samples/bin/JaxWSServicesSamples and run the Sample.