Deploying a Web service
Below are the steps required to create and deploy a Web service created in VAST Platform. In this example you will:
Start an SST HTTP server to serve required XML/WSDL documents
Start a Web service container (defined below)
Deploy a Web service to the container
Web Services Container
VAST Platform manages Web services through the use of a Web services container. The purpose of the container is to facilitate the lifecycle management of a Web service. The container acts as a 'home' for the different services. Various managers and factories coordinate the web service infrastructure as web services are deployed into the container. Once a service is deployed, it can be located in the container by utilizing the SstWSContainer API, #serviceNamed:inNamespace:.
Another important aspect of the container is the ability to establish and manage a collection of application server endpoints -- i.e. specific locations for accessing a Web service using a specific protocol and data format -- whose sole responsibility is to facilitate service requests. When a Web service is deployed, the container creates and manages application server endpoints which listen for and respond to web service requests, typically using TCP.
A SOAP node does not generally process requests to deploy a Web service. For this example we have introduced a separate HTTP server to retrieve the WSDL documents required for deployment of the service into the container. We recommend that a separate HTTP server be started (e.g. SST HTTP Server, IBM HTTP Server, or Apache Tomcat) that will serve up the WSDL documents.
 
For more on the container framework, refer to The Container Framework.
 
Example
The steps below start an HTTP server, start the Web service container, and deploy the Web service using the insurance policy example deployment descriptors SstWebServicesInsuranceExample described in “Creating a Web service”.
Note:
The examples in this guide specify URL resources using a host name of 'vasthost'. You must add a line to your 'hosts' file, or use any hostname valid for your environment in place of 'vasthost', in order to successfully execute the described examples.
ie)
127.0.0.1 vasthost
The HTTP server used is a sample one, SstHttpServerExample, which is included in the Server Smalltalk (SST) feature which is loaded along with the Web Services feature. However, the external server could be any any HTTP server. The server used in the example runs on port 999 on VASTHOST, but this can be any valid HTTP URL.
1. Start an SST HTTP server or equivalent on port 9999 on VASTHOST. If you use SST, it is recommended that you inspect the results to ensure you can properly shut down the server at the end of the examples by sending the message shutDown to the server.
 
|server|
server := SstHttpServerExample runAt: 'http://:9999'
in: (AbtXmlConfiguration current defaultResourceQualifier).
Note:
Do not close the log window resulting from executing the above Smalltalk expression until you are finished with the examples and want to close the Smalltalk image.
 
2. Start a container to host all deployed services.
Note:
In actual practice, an application may use multiple containers. This is useful when testing an application, but not recommended for run-time applications. To keep this example simple, this code snippet  will explicitly clear all existing containers to ensure that you are starting clean.
 
[ | aContainer |
SstWSContainer clearAll.
aContainer := SstWSContainer
createContainerNamed: SciSocketManager default getHostName
using: (SstWSContainerConfiguration defaultConfiguration).
aContainer startUp.
aContainer inspect ] fork
3. Once the container has been started, a web service may be deployed into the container. The web service may be defined inside of a WSDL document or described in a deployment descriptor. The deployment descriptor is an XML file that provides meta information about the service, such as the implementation class and the location of the service WSDL.
The XML document (and the documents that are imported) is fetched from the external server started in step 1. During deployment, VAST Platform attempts to start the network endpoints required in order to host the described services. This is accomplished using information derived from the WSDL port entries from the WSDL document.
The sample code below locates the container created in step 2 and deploys the service described in the XML deployment descriptor into that container.
 
[ | aContainer aServiceCollection |
aContainer := SstWSContainer containerNamed:
SciSocketManager default getHostName.
aServiceCollection := aContainer
deploy: 'http://vasthost:9999/SstWSInsurancePolicyInterface.xml'.
aServiceCollection inspect ] fork
That's it! After completing the steps above, it is possible to invoke the deployed service via SOAP messages over HTTP. The next section describes how this is done with VAST Platform.
Last modified date: 02/12/2021