InfoCenter Home >
4: Developing applications >
4.8: Web services - an overview >
4.8.1: Web services components >
4.8.1.2: SOAP support >
4.8.1.2.1: SOAP samples

4.8.1.2.1: SOAP samples

WebSphere Application Server 4.0 provides sample services and clients that demonstrate how to access SOAP services. The SOAP samples code is based on the the Apache SOAP 2.2 samples. These samples are contained in the soapsamples.ear that is located in the installableApps directory. The source for the sample services is located in the soapsamples.ear.

See article DB2 Stored procedure sample setup for information on configuring a datasource to set the db2-userid and db2-password entries.

Perform the following steps to install the samples in your server:

  1. Use the enterprise application wizard in the administrative console to install the EAR file. See article Installing files and setting classpaths for more information.
  2. To access the sample services from an external Web server, run the file GenPluginCfg.sh on UNIX or GenPluginCfg.bat on Windows NT. This file makes the Web server aware of the SOAP samples.
  3. Start the product.
  4. Check on the availability of the sample services using the XML-SOAP Admin tool:
    1. From a browser, go to URL
      http://localhost/soapsamples/admin/index.html
    2. At this site, you can:
      • List available services
      • View the Apache SOAP descriptors
      • Stop and start sample services

Running the sample clients

Sample clients are provided to demonstrate how to access the installed SOAP services. These scripts require you to specify the server that will handle the request.

  If you run the script with no arguments, as for example StockQuoteSample, you will be provided with help on how to use the sample, and you will receive a description of the command line arguments that the script requires.

To access the samples, change the directory to the following on Windows NT:
product_installation_root\installedApps\soapsamples.ear\ClientCode\nt_bat

On UNIX platforms, the samples directory is:
product_installation_root/installedApps/soapsamples.ear/ClientCode/unix_scripts

  Issue the chmod 755 *.sh command to restore the execution permissions of the UNIX scripts.

Sample Command (entered on a single line)
Stock quote (requires Internet access) stockquotesample localhost IBM

If the request appears to hang, and then you receive an "Operation timed out" error, the service was unable to reach a server on the Internet to obtain the stock quote information. You may need a direct connection to the Internet.
Address book AddressBookSample
GET localhost "John B. Good"
AddressBookSample
ALL localhost
AddressBookSample
PUT localhost "Herman Munster" 1313 "Mockingbird Lane" Salem MA 10013 111 222 3434
Address book example 2 Addressbook2sample localhost
EJB EJBAdderSample localhost
On UNIX platforms, enter:
EJBAdderSample.sh localhost
Send Message sendMessageSample localhost ..\data\msg1.xml
Calculator Sample CalculatorSample localhost
   Unlike the other SOAP samples, which are either java or enterprise beans, the Calculator Sample is a JavaScript sample. The actual calculator processing is performed by the Web service.
Mime Client sample MimeClientSample localhost ..\data\foo.txt
DB2SPSample sample DB2SPSample localhost
On UNIX platforms, enter:
DB2SPSample.sh localhost

Troubleshooting SOAP sample problems

If you cannot run the SOAP samples, check for the following problems:

  • Can you run any of the samples, such as http://localhost/servlet/snoop? If not, make sure the Web server is running.

      If you can run the snoop sample, try accessing one of the SOAP samples again, but this time specify the port number 9080 in addition to the host name, as for example:

      MimeClientSample localhost:9080 ...\data\foo.txt
      If adding the port number resolves the problem, you need to update the plugin configuration by running the GenPluginCfg.bat file on the Windows platform, or the GenPluginCfg.sh file on UNIX platforms.
  • If the stockquote sample fails but the other samples work, you are having problems accessing the external Internet.

See the Related topics section for links to an enablement tutorial.

Go to previous article: SOAP support Go to next article: Building a SOAP client

 

 
Go to previous article: SOAP support Go to next article: Building a SOAP client