Web services may be invoked by passing SOAP messages over HTTP connections. The Web services framework insulates us from the chore of manually creating SOAP messages. In this manner, the Smalltalk messaging semantics are maintained.
The Web service object and the container encapsulate the notion of service location transparency. For example, it is expected that a service should be able to handle both remote message invocations (those from outside its Smalltalk image), and local message invocations (those from inside the same image). Therefore, after a service is found in the container, messages dispatched to the service follow the pattern described below:
To invoke the service deployed in the previous example, execute the following code:
[ | aContainer aService| aContainer := SstWSContainer containerNamed: SciSocketManager default getHostName. aService := aContainer serviceNamed: 'SstWSInsurancePolicyInterface' inNamespace: 'http://www.SstWSInsurancePolicyInterface.com/SstWSInsurancePolicyInterface'. aService about inspect ] fork
In the code example above, the service invokes the 'about' operation locally because information regarding the service implementer was included in the service deployment descriptor used to deploy the service.
The example below demonstrates how to simulate remote invocation of the operation by using a separate Web services container. The use of multiple Web services containers is recommended for testing purposes only. Do not use multiple containers in your deployed runtime applications.
[ | aContainer aServiceCollection aService| aContainer := SstWSContainer containerNamed: 'ClientContainer' ifNone: [ SstWSContainer createContainerNamed: 'ClientContainer' ]. aServiceCollection := aContainer deploy: 'http://vasthost:9999/SstWSInsurancePolicyInterface.wsdl'. aService := aServiceCollection first. aService about inspect ] fork