The following diagram shows the type hierarchy for two distinct implementations of service calls to invoke the getRootElements WSAPI service. IAGetRootElementsSvc is an interactive implementation, prompting the user to enter data from which it generates the appropriate arguments. ScrGetRootElements is the scripted implementation of the same service. It uses a reference to a previously executed GetRootElements service call to provide arguments to the new service call invocation. The abstract classes between these two implementation classes and the ServiceCall interface provide a common framework for ServiceCall implementations. The AbstractServiceCall class is the common base for all service call implementations. It provides access to the client context, and implements common functionality, such as invoking post-processors.
Figure 5-3 ServiceFactory and ServiceCall
The GetRootElementsSvc class is specific in the getRootElements WSAPI service. There are comparable classes for each WSAPI service (such as LoginSvc or CreateElementSvc). All of these service-specific classes follow the same model:
They implement gatherParms() by calling abstract gatherArgument methods that collect the service arguments from the concrete class.
They provide a concrete implementation of doServiceCall() that invokes the Web service and stores a reference to the response.
They delegate argument collection and post processing to the concrete implementation.
The two ServiceFactory implementations shipped with MosWsClient are shown at the bottom of the diagram:
IAServiceFactory: Used for interactive service invocations. The getService() method shows the main menu, and based on the user selection, it instantiates and returns the appropriate interactive ServiceCall implementation.
TestScriptPlayer: Used for playing recorded scripts. The getService() method reads the next service invocation from the script file and based on its type, it instantiates the appropriate scripted ServiceCall implementation.
New ServiceCall and ServiceFactory implementations are needed to embed the client in another application. ServiceCall implementations should extend the appropriate service-specific class in order to be compatible with other features such as record/playback.