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 VAST Platform, we recommend that you read
Getting Started: Web services in an Hour and the associated links before you begin.This provides a more basic understanding of Web Services as well as the
setup needed to run the examples.
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.
• about answers a string describing the service
• ratePolicy answers a floating point rate for a policy number expressed as a string
• getAllPolicies answers an array of policies
• getInfoForPolicy answers a policy for a policy number expressed as a string
• updatePolicy replaces the policy in the list of available policies by the policy passed from the client
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.
VAST Platform 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.
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. Use Smalltalk tools to create the service deployment files and place them in the xml directory of your VAST Platform installation.
3. Manually modify the files generated so the correct address of the server is in the wsdl, and the types of data passed between the service and its clients are specified correctly.
4. Start a container on the server image and deploy the service into that container (the Web Services framework.)
5. Invoke the web service from an image in which the service is deployed into a container as a client.
XML directory
The default resource qualifier is <varoot>/xml where <varoot> is the installation directory. A permission problem occurs 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.
Last modified date: 01/14/2023