Deploying the Web Service In the Server Image
Editing the Deployment Descriptor File
If you chose to generate XML for document literal style, you will need to modify the server side deployment descriptor SstWSInsurancePolicyInterface.xml file.
For specific information
The XML stanza below needs to be added after the wsdlUrls tag and before the service tag.
<handlers namespace="http://www.SstWSInsurancePolicyInterface.com/SstWSInsurancePolicyInterface" >
<operationHandler name="docLitExampleHandler" class="SstWSServiceOperationHandler">
<input name="docLitInputHandler" class="SstWSInsurancePolicyDocLitHandler"/>
<output name="docLitOutputHandler" class="SstWSNoOperationHandler"/>
<fault name="docLitFaultHandler" class="SstWSNoOperationHandler" />
</operationHandler>
</handlers>
This XML stanza registers a custom handler necessary for the server to process a document literal style web service request. Note that only the input handler is customized. More information about custom handlers can be found here:
Web Service Handlers and Message ProcessingThe automatically generated operations listed in the <operations> section need to be edited to add a flow attribute in order to link the custom handler to the operation:
<operation flow="doclit:docLitExampleHandler"
name="about">
qName="swssipi:about"
</operation>
The namespace prefix declaration xmlns:doclit="http://www.SstWSInsurancePolicyInterface.com/SstWSInsurancePolicyInterface" needs to be added to the vastwsd:deployment tag at the beginning of the file:
Deploying the Web Service
Once the server deployment descriptor file has been edited, the service can be deployed into a container. The code to create a container and deploy the web service is found in Appendix A:
Server Workspace Code.
Invoking the Web Service from a Client Image
Although wsdl files can be deployed directly into a container, this example creates a deployment descriptor for the client. To create this deployment descriptor file, copy the server deployment descriptor file ‘SstWSInsurancePolicyServerInterface.xml,’ created in the previous step into a new file, ‘SstWSInsurancePolicyClientInterface.xml’. Edit this file and comment out the following line:
<vast:provider className="SstWSInsurancePolicyInterface" creationMethod="new"/>
The absence of the provider class name identifies the service deployment as a client.
Specific doc literal change:
The definitions of the two operations which do not pass a parameter (about and getAllPolicies) differ in the client and the server. Modify the “about” and “getAllPolicies” name attribute to place a colon following the operation name:
<operation flow="doclit:docLitExampleHandler"
name="about:">
qName="swssipi:about"
</operation>
…
<operation flow="doclit:docLitExampleHandler"
name="getAllPolicies:">
qName="swsipi:getAllPolicies"
</operation>
Invocation is accomplished using a one-argument method despite the fact that “about” and “getAllPolicies” do not actually require an argument. Using doc-literal encoding, operations that don't require arguments must still specify WSDL part elements to describe their message structure. Thus the invocation for doc-literal messages which do not require arguments contains one nillable argument to conform with convention.
Save the changes to SstWSInsurancePolicyClientInterface.xml
Deploying the Client and Invoking the Web Service
The client VA Smalltalk installation must have the XML, WSDL, and the modified deployment descriptor ‘SstWSInsurancePolicyClientInterface.xml’ in its <vas>/xml directory.
The Smalltalk code to deploy and invoke the Insurance Policy web service is found in Appendix A:
Client Workspace Code. Note that all the operations are included in comments. You can either uncomment the operation you would like to send, or execute it in the inspector that opens upon executing the workspace.
Although there are four operations defined for this web service, only two will function properly in this example. This is because most of the operations return complex types. A mapping specification and schema type definitions are required to properly send complex data types. Another example covers these modifications. About returns a string; ratePolicy returns a float which the web services framework can convert to a string without additional mapping or schema type definitions.
Doc Literal Operation Invocation:
(aService about: nil) inspect.
(aService ratePolicy: '29467810') inspect.
RPC Operation Invocation:
aService about inspect.
(aService invoke: 'about' withArguments: #( )) inspect.
(aService ratePolicy: '29467810') inspect.
(aService invoke: 'ratePolicy' withArguments: #( '29467810' )) inspect.
Each operation has alternate means of invocation.
Summary
This example has shown how to create and modify the necessary xml and wsdl files for both a server and client web service. It also provides code that can be executed in a workspace to deploy and invoke the web service.
Last modified date: 08/16/2019