Getting Started: Web services in a Day

Getting Started: Web services in a Day
This section offers a more in-depth look at the insurance example shipped with the product. If you are unfamiliar with the basic functioning of web services in VA Smalltalk, we recommend that you read Getting Started: Web services in an Hour and the associated links before you begin.
This section shows how to host and invoke a web service using two different smalltalk images. A complete example is shown for document literal, rpc literal and rpc encoded WSDL styles. The domain classes are an insurance policy, a person, and an address. The SstWSInsurancePolicyInterface class is the glue between the domain and the web service framework; for the purposes of demonstration, this class stores a small dataset of insurance policies.
The Web Service Interface Class
The SstWSInsurancePolicyInterface class is in the application SstWebServicesInsuranceExample. Notice the five methods in @Ws-API category. These are the methods which will be exposed as a web service.
Environment
In order to run the Smalltalk examples, the Web Services feature must be loaded.
The sample web service was tested on a single machine with two Smalltalk images. If these two images access the same repository, they must be configured for team use using emsrv. See the Installation Guide for details.
VA Smalltalk tools generate templates for all required WSDL and XML files. Additional manual editing is required for some of the styles. Instructions on how to use the tools are given.
The complete workspace code for each example appears in Appendices at the end of this guide.
Examples
There are three main topics that will be addressed in this section: using different WSDL styles, passing complex types and custom handlers.
Passing complex data types to and from your service
In general, the steps to create deploy, and invoke a web service are:
1.
Create a Smalltalk class which performs the duties to be supplied by the service. The class SstWSInsurancePolicyInterface is used as the sample web service. It is available in the shipped product repository.
2.
3.
4.
5.
 
XML directory
The default resource qualifier is <varoot>/xml where <varoot> is the installation directory. A problem occurs on UNIX, and Windows Vista and later with UAC enabled, if a web service attempts to write into this directory since normally this directory can only be written into by the root user. The solution is to use the Environments tool to copy the <varoot>/xml directory to your working environment and update the .INI file for your working environment to point to the new location.