Packaging a Web service
VAST Web services are modular software components. Therefore, properly designed services are well-suited for deployment as VAST Platform (VA Smalltalk) image components. This section describes how to use the VAST packager to construct a Web services "platform" capable of dynamically deploying and hosting multiple Web services. Once the platform is constructed, it is simple to create image components that contain individual Web services. These services can be then deployed at runtime to the Web services platform image. For applications that cannot be easily structured as image components, the reduced runtime packaging strategy is also supported. See the following table for further information on packaging guidelines:
Table 2.
| | |
Headless Server | Recommended | Supported |
UI Client | Supported | Recommended |
Building a Web services platform
This section supplements materials on packaging into image components (ICs) in the Smalltalk UserGuide.
The Web services feature includes a collection of reusable image components, which can be used to construct a Web services platform image component. The Web services platform must be constructed as a "leaf" image component in order to be startable. At a minimum, the packager specifications for the Web services platform IC should include the Web services reusable image component. Other applications and image components can be included in the leaf image component at package time; however, creating a minimal Web services start up image component is recommended to provide more versatility. Commonly used image components can be dynamically loaded at runtime by listing them in the <imageComponentUrls> section of the container deployment descriptor.
Building a service image component
Individual services that are to be deployed to the Web services platform should be packaged as reusable image components. Doing so allows these services to be dynamically loaded into a Web services platform at runtime instead of including them in the Web services platform image. See the
Smalltalk User Guide section "Creating a reusable and a leaf IC" for detailed information about building reusable image components.
Packaging Web services clients
No special steps are required when building client images that utilize VAST Web services support. Follow the instructions in the Smalltalk User Guide.
Packaging the Web services platform from an XD passive image
For services that are to be deployed as image components, you should begin by constructing a headless Web services platform image.
To do this, you must first construct an XD passive image for the target operating system. (See the server guide for information about building a passive image).
An example packager instruction class is provided to assist in building the headless Web service platform. The instructions below describe how to build the platform using the example packager instructions.
•From the XD Packager Control Panel, select the Instructions in Database tab.
•Double click on SstWebServicesPackagingExamples, and select the instruction class SstEgWSPlaformICInstructions
•Click the Reduce button
•Click the Output Image button to construct an image file
Packaging the Web services insurance example as a reusable image component (XD passive image)
Verify that the applications SstWebServicesInsuranceExample and SstWebServicesInsuranceExampleWSExtensions are loaded into the image where packaging will occur. These examples are not automatically loaded into passive images with the Web services feature.
•From the Choose Instructions option, select the Create New Instructions tab.
•Select XD Reusable Image Component
•From the Modify Instructions option, select the Applications and ICs tab
•Select both SstWebServicesInsuranceExample and SstWebServicesInsuranceExampleWSExtensions.
•Add Available Prerequisite IC named SSTEG Web services platform IC Select the Startup Code tab and specify an Output File name (ie. wsinsurance.ic)
•Click Reduce button Click the Output image button to construct an image file
Reduced runtime packaging
Some organizations may prefer to use the reduced runtime approach to runtime packaging. While this approach limits runtime flexibility in deployment and loading of services, it may offer a simpler technique for packaging less sophisticated service architectures.
When specifying the 'Applications and Ics' to be included in the packaged image, be sure to include the applications that comprise your service as well as the Web services support base application SstWebServicesHttpSupport.
Since Web services are often configured and deployed using information from external XML resources, it is often necessary to suppress reduction for some applications, classes, and methods.
For example, during service deployment the Web services framework parses WSDL documents into Smalltalk objects. Since the resulting Smalltalk WSDL objects are not directly referenced by application code, the classes must always be included in runtime images by preventing reduction. The sample packaging instructions shown below demonstrate how reduction can be prevented.
The same issue occurs with methods. If a method –typically a getter or setter – is only referenced by a perform: method, it will be reduced by the packager. The web services framework makes use of perform: during serialization and deserialization. Methods referenced in this way must be specifically included by creating a class method on a class or application which lists the selectors which should not be reduced:
packagerIncludeSelectors
^#( selector1 selector2 selector3)
See AbtXmlSerializationBaseApp for an example or browse for implementors of packagerIncludeSelectors to find specific examples.
To prevent reduction of an entire application or subapplication, implement the class method #packagingRulesFor: in the application class as shown below:
packagingRulesFor: aPackagedImage
aPackagedImage doNotReduceSubApplicationNamed: self symbol
To prevent reduction of individual classes, implement the class method #packagingRulesFor: in the application class as shown below:
packagingRulesFor: aPackagedImage
aPackagedImage doNotReduceClassNamed: #SstWSContainer
Runtime considerations
Using the command line option '-ws:', it is possible to specify a container deployment descriptor file defining the specifications to deploy a Web services container. It is not necessary to specify start up code if you intend to use the '-ws:' command line option. Alternatively, you can specify startup code to deploy a container or start a container from #runtimeStartup method in one of the application classes included in the leaf IC.
The Web services platform will shut down if no network endpoints are activated in the image. A simple way to start a network endpoint to the Web services runtime is to deploy a hosted service that specifies endpoint information in its deployed WSDL file.
Application prerequisites for services
Individual services need not include Web services support in their prerequisites. The VAST Web services support merely provides a mechanism for invoking behavior defined by services.