Calling XQuery through a Web Service

Tamino provides a plugin wizard that enables you to expose XQuery functions that are defined in an XQuery module as a web service. The wizard generates a web service archive that can subsequently be processed either manually or by means of the Software AG Web Services Stack (WSS).

The following topics are discussed in this document:


Setting Preferences

Before using the wizard to generate a web service archive, you can set preferences that specify its behavior. There are two sets of preferences:

Database Selection

In a later step, the XQuery web service wizard prompts you to select a Tamino database from a selection list. In order to populate the selection list, proceed as follows.

In Eclipse, choose Window > Preferences. Then, in the navigator tree, select Software AG > Tamino > Tamino Database List. The list of Tamino databases available for selection is displayed, as shown in the following screenshot:

graphics/webser_01.png

You can now use the Add..., Edit... and Remove functions to modify the selection list as required.

Note:
In order to generate a web service successfully, the database selection list must contain at least one entry.

XQuery Web Service Preferences

In Eclipse, choose Window > Preferences. Then, in the navigator tree, select Software AG > Tamino > XQuery Web Service. The list of preferences for the Tamino XQuery web service wizard is displayed, as shown in the following screenshot:

graphics/webser_02.png

The following paragraphs describe the available preferences.

Select Tamino database via URL

This switch specifies whether the database selection list that appears in subsequent wizard screens should display the names of the databases or their URLs.

Default: The database selection list displays the databases by name.

Display generated WSDL

This switch specifies whether the WSDL file that is generated by the wizard should be shown to the user; at the same time, the user is given the opportunity of saving the WSDL file in the file system.

Default: Do not display the WSDL file.

Select the destination of the generated service archive

This specifies whether the generated service archive should be stored to a user-specified file system location, or in an Eclipse project (where it can be further processed by means of the Software AG Web Services Stack). You can also specify the name of the desired Eclipse project here.

Default: Store the generated service archive in an Eclipse project named XQueryWebService-Archives.

Using the Wizard

The XQuery Web Service wizard plugin runs in your Tamino Eclipse environment. To start the wizard, choose File > New > Other; then, in the tree view, select Software AG > Tamino > XQuery Web Service, as shown in the following screenshot:

graphics/webser_03.png

Choose Next. The XQuery Web Service wizard starts, and displays a page from which you can select a Tamino database from the pulldown database list, which was constructed using the preferences as described above:

graphics/webser_04.png

Choose Next to display the next page of the wizard:

graphics/webser_05.png

Here you can select an XQuery module from the chosen Tamino database. A default name is suggested for the web service.

In the following screenshot, you see that a module has been selected; the wizard now shows all the functions that are included in the selected module, and displays a checkbox for each function. Check (tick) each function that should be included in the XQuery web service.

graphics/webser_06.png

The following screenshot shows that several functions have been selected. Also, the user has overwritten the default name for the web service by the name MyFirstService.

graphics/webser_07.png

The next step depends on the setting on the preference Display generated WSDL, which was specified above. If this option was selected (i.e. checked/ticked), the next screen displays the generated WSDL and you can use the Save As button to save it to the file system, as shown in the example below. If this option was not selected, this step is skipped.

graphics/webser_08.png

Finally, pressing the Finish button generates the web service archive, either at a selected file system location or in the Eclipse project as shown below, according to the preferences described above.

graphics/webser_08a.png

Using the Generated Web Service

After the web service archive has been generated and written to the Eclipse archive, you can use the Software AG Web Services Stack (WSS) to process it further. In the Eclipse package explorer, double-click on the archive; this opens the Web Services Stack editor, where you can set some service properties, as shown below:

graphics/webser_18.png

For further details, please refer to the documentation of the Software AG Web Services Stack.

You can also use the Web Services Stack to deploy the generated web service, and to register it in CentraSite. These functions can be accessed from the archive context menu (right mouse button).