# VisualAge Smalltalk Web services Quick Tester

The Quick Tester demo is a simple but useful VisualAge Smalltalk application that allows users to perform a 'quick test' on deployed Web services. The demo utilizes information derived from WSDL to dynamically construct an appropriate user interface for any WSDL operation. At runtime, supplied inputs are serialized into SOAP messages and passed to the target service endpoint. By applying concepts from industry standards including SOAP 1.1, WSDL 1.0, and XML schema 1.0, VisualAge Smalltalk V6.0.2 (VAST) supplies a very flexible and pluggable platform for hosting and invoking Web services. The Quick Tester demo exploits the flexibility of the VAST Web services infrastructure by adding an HTML interface that enables invocation of properly described services built with any tool!

- Configuring the Quick Tester
- Starting the Quick Tester
- Deploying services
- Invoking service operations
- Loading the Quick Tester application
- Understanding the Quick Tester application
- Invoking service operations
- Starting Quick Tester application in a development enviroment
- Invoke UDDI using Quick Tester
- SST Debugging tip
- Packaging the Quick Tester
- Packaging and deploying the Quick Tester as an NT service

## Configuring the Quick Tester application

The files vawcmast.gif and poweredBySST.gif must be copied from the .\htmlwrappers demo directory to a directory accessible by a web server. The application files that reference these gifs must be updated to reflect the new location. The vawcmast.gif file is referenced as the masthead for all of the .html files in the .\htmlwrappers directory. The poweredBySST.gif file is referenced only by deploy.html. Users can supply their own gif files to create a customized look for the Quick Tester.

By default, the Quick Tester application listens for HTTP requests on port 63003. If desired, the server port can be changed by modifying the configuration file wsistart.cfg in the base demo directory.

## Starting the Quick Tester application

The batch file wstester.bat can be run from the command line or from the Windows Explorer. The batch file starts an HTTP server in VisualAge Smalltalk to enable execution of the Quick Tester application. After VisualAge Smalltalk is started, you can access the Quick Tester deployment page at the URL http://<myhost>:63003/AbtWebConnect/AbxWebServicesDeployPage.

## Using the Quick Tester application

### Deploying services

Deploy remote services to the VisualAge Smalltalk Web services platform by entering a valid WSDL URL name and clicking the 'Deploy WSDL' button. Deploying the remote service allows VAST to perform the initialization tasks required to properly invoke the operations of the service. You can start by deploying one or more of the WSDL resources listed below. A collection of other various services can be found at http://www.xmethods.com.

- http://webservices.matlus.com/scripts/WordFind.DLL/wsdl/IWordFind
- http://services.xmethods.net/soap/urn:xmethods-delayed-quotes.wsdl

If the WSDL deploys successfully, the WSDL URL is added to the 'Deployed WSDLs' drop down list and selected.

### Invoking service operations

Select the WSDL URL that contains the desired operations:

- Click the 'Invoke operations' button to explore the operations provided by the service
- Select the desired operation, and click 'Build inputs' to construct an HTML table that contains the input arguments for the operation
- Supply values for all necessary inputs, and click the 'Invoke ' button to invoke the operation passing the supplied argument values
- When applicable, a '*' is placed next to those input arguments that are required as determined from the XML schema element definition

## Enhancing the Quick Tester application

This section is useful for those who wish to use the VisualAge Smalltalk development environment to view and understand the source code for the Quick Tester application.

### Loading the Quick Tester application

1. Add the DefaultFilePath entry to the [Html File Wrappers] stanza of the VisualAge .ini file (as shown below) to specify the file path for the htmlwrapper files installed with the Quick Tester goodie.

       [Html File Wrappers]
       DefaultFilePath=.;d:\goodies\wstester\htmlwrappers\;

2. Load the following features using the Transcript menu option 'Tools->Load/unload features...'
   - ST: Server, Web Services
   - VA: WebConnection
3. Import the application 'AbxWebServicesQuickTestApp' from the library file .\import\quicktest.dat
   - Open application manager. From the System Transcript, select (Tools->Manage applications)
   - Import the application (Applications->Import).
     - Blank out the host name when prompted; use the file prompter to find the 'quicktest.dat' file and select it.
     - Select AbxWebServicesQuickTestApp; select the listed version; and use the '>>' button to select the application for import
     - If you intend to package the Quick Tester application for runtime deployment, import the application AbxWebServicesQuickTestPackagingApp
     - If you intend to package the Quick Tester application as a Windows NT service, import the application AbxWebServicesQuickTestServiceApp
4. Load application AbxWebServicesQuickTestApp
   - From an 'Application Manager', select 'Load->Available...'
   - Select the listed version of application AbxWebServicesQuickTestApp
5. Save image using the Transcript menu option 'File->Save image'

### Understanding the Quick Tester application

The Quick Tester application takes advantage of several of the powerful features included with VisualAge Smalltalk Version 6.0.

- The Web Services feature provides the infrastructure that enables the Quick Tester to deploy and invoke a wide variety of remote Web services with minimal coding
- The Web Connection feature is used to provide the user interface and application flow for the Quick Tester. HTML file wrappers are used to provide the visual layout for the various pages, and application session information is retained using the session data feature of Web Connection.
- Server Smalltalk (SST) provides the communications infrastructure that enables remote Web services to be easily invoked. Additionally, the HTTP server capabilities of SST are used to enable serving of Web Connection HTML pages

The Quick Tester application consists of two Web Connection parts, AbxWebServicesDeployPage and AbxWebServicesInvokeOperationsPage. These parts act as controllers that govern application flow and populate the HTML file wrapper that is to be returned to the browser. HTML file wrappers are classes that act as templates (similar to Java JSPs) to wrapper HTML files containing both static and dynamic content. Parameter markers in the HTML files are populated with dynamic content at runtime by controlling Web Connection parts . The particular HTML file wrapper to be returned to the browser can be set at runtime by setting the primaryPart of the Web Connection part to the appropriate wrapper instance. Methods are categorized in the image as follows:

- Quick Tester - Web Services
  - Methods that participate in the deployment and invocation of Web Services
- Quick Tester - HTML generation
  - Methods that participate in the generation of dynamic HTML content
- Quick Tester - Internal
  - Infrastructure methods

One of the very powerful features of VisualAge Smalltalk is the ability to extend the behavior of a class without the need to create a new subclass. Class extensions can be used to add new methods to an existing class without affecting its base definition. The Quick Tester exploits this capability by adding the method abxAddHtmlInputObjectsTo:context: to many of the XML schema classes. The extensions make it possible to walk the contents of an XML schema declaration allowing each element to append an appropriate HTML representation to the HTML element tree.

### Starting the Quick Tester application in a development environment

Use the Web Server Interface Monitor user interface to start an sst-http server on a specified port.

1. From the System Transcript, select 'Tools->Open Web Server Interface Monitor'
2. Click the 'Start a WSI Server...' button.
3. Specify a transport of 'sst-http' and a port number of 63003 (or another port of your choosing)
4. Click the 'Start' button to start an HTTP server on the specified port

After the 'sst-http' transport is started, you can access the Quick Tester deployment page at the URL http://myhost:63003/AbtWebConnect/AbxWebServicesDeployPage.
NOTE: The Transcript menu option 'Tools->Open Web Browser Launch Options' can be used to specify the URL path for Web Connection parts. Properly setting this option enables launching of Web Connection parts using the VisualAge Organizer test button.

### Invoke UDDI using Quick Tester

The UDDI registry API is exposed as a Web service and WSDL containing interface information is provided. In order to deploy the service, you must create your own implementation WSDL as shown below and deploy it. Notice that the implementation WSDL imports an interface WSDL document containing the abstract UDDI service interface.

    <?xml version="1.0"?>
    <definitions name="VASTWebServiceUddiExample"
      targetNamespace="urn:uddi-org:inquiry_impl"
      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
      xmlns="http://schemas.xmlsoap.org/wsdl/"
      xmlns:uddi-inquiry="urn:uddi-org:inquiry" >
      <import namespace="urn:uddi-org:inquiry"
              location="http://www.uddi.org/wsdl/inquire_v1.wsdl"/>
      <service name="IBMPublicUddiInquiryService">
        <documentation>VAST Web Service Uddi Example</documentation>
        <port name="IBMPublicUDDIInquiry" binding="uddi-inquiry:InquireSoap">
          <soap:address location="http://www-3.ibm.com/services/uddi/inquiryapi"/>
        </port>
      </service>
    </definitions>

The UDDI service has various operations that demonstrate passing of complex parameter structures.

### SST debugging tip

By default, the Server Smalltalk (SST) feature traps and handles exceptions (including breakpoints) that occur during request processing. To disable the default exception handling of SST, perform the tasks below:

- From the Transcript, select 'Tools->SST->Forward exceptions...'
- Select all items from the 'Enabled' list, and move them to the 'Disabled' list
- Click 'OK'

The VisualAge Smalltalk debugger will now open when breakpoints are encountered.

### Packaging the Quick Tester

The provided runtime for the Quick Tester application demonstrates a recommended technique for packaging server applications in VisualAge Smalltalk. The general approach is that a platform is packaged which contains all common infrastructure necessary for executing a set of applications. Individual applications can then be packaged as separate components and deployed to the platform.

The application AbxWebServicesQuickTestPackagingApp contains packager instructions to:

- Build a platform image component that contains the Web Services and Web Connection base infrastructure code (sstwsqt.ic) using the instructions in AbxWebServicesQuickTesterPackagingInstructions.
- Build a reusable image component that contains the Quick Tester application (abxqtest.ic) using the instructions in AbxWebServicesQuickTesterPackagingInstructions.

Packaging must be done from an XD passive image.

### Packaging and deploying the Quick Tester as an NT service

#### Packaging the NT service

The VAST Quick Tester download includes packaging instructions for packaging the Quick Tester application as an NT service. Following are the steps for building the VAST Quick Tester NT Service:

- Load the application AbxWebServicesQuickTestServiceApp
- Package the platform image component for the service (sstwsqt.ic) using the packaging instructions in AbxWebServicesQuickTesterPlatformServicePackagingInstructions.
- Package the reusable image component for the Quick Tester application (abxqtest.ic) using the packaging instructions in AbxWebServicesQuickTesterServicePackagingInstructions.
- Copy the new version of sstwsqt.ic to the .\wstester directory. This will replace the existing copy of the image component, so make a backup copy if desired.
- Copy the new version of abxqtest.ic to the .\wstester\ics directory. This will replace the existing copy of the image component so make a backup copy if desired.
- Create a runtime image (sstwsqt.icx) based upon the platform image component sstwsqt.ic. This can be accomplished by executing the batch command file .\wstester\makeicx.bat.

#### Deploying the NT service

1. Add the \wstester\bin directory to your permanent system PATH, or copy all DLL and EXE files from the \wstester\bin directory to a directory that already exists in the PATH. NOTE: If you add a new directory to the system PATH, you may need to reboot to activate the change.
2. Go to the \wstester\service directory and execute the register.bat file. This will add the service 'VAST Quick Tester' to the Windows service collection. It may be necessary to edit the register.bat file before executing in order to properly specify the srvWorkingDir argument. The value should be the directory where the runtime image is located.
3. Go to Windows "Services" panel and start the service.
   - Control Settings->Control Panel->Administration Tools->Services
   - Select "VAST Quick Tester"
   - Click right mouse button, and select "Start"
   Errors during service start up are typically due to the absence of required executable files from the system PATH. Modifications to the PATH may not be active until the computer is restarted. Information about application problems is written to the file sstwsqt.log in the startup directory.
4. Verify that the service is active. Go to a Web browser, and enter the URL -- http://hostname:63003/AbtWebConnect/AbxWebServicesDeployPage
5. Customize the service definition if desired. It may be desirable to automatically start the service whenever the computer is restarted.
6. If you wish to remove the service, use the unregister.bat file in the .\wstester\service directory.