Web service as a DataWindow data source

In DataWindow .NET 2.5, you have the option of selecting a Web Service data source for all DataWindow presentation styles.

Selecting a WSDL file

When you select Web Service as the data source and click Next, the DataWindow wizard opens a page that prompts you to select a WSDL file. You can type the URL to a WSDL, ASMX, or XML file, or you can browse to a mapped drive or search a UDDI directory for these types of files.

The Choose WSDL File page of the DataWindow wizard also lets you name the assembly file that the wizard will create. The assembly file serves as an interface between the DataWindow and the Web service. If you do not name the assembly file, the wizard will select a name for you based on the name of the WSDL file entry.

Selecting a service

The next step to access a Web service data source is to select a service described in the WSDL, and then one of its public methods. You complete the wizard as you would when using any other type of data source for your DataWindow.

No SQL Select painter

After you complete the wizard, the DataWindow displays in the DataWindow painter. However, there is no equivalent to the SQL painter for a DataWindow with a Web service data source. For this type of DataWindow, you cannot select Design>Data Source from the DataWindow painter menu to change selected columns or modify the DataWindow syntax.

NoteRuntime requirements on a deployment computer To run the Web service DataWindow application from a deployment computer, the assembly file that you generate with the wizard must be copied along with the application executable and some required runtime DLLs. For information on the required DLLs and the Runtime Packager tool that you can use to deploy them, see “Deploying DataWindow .NET Applications” in the Programmer’s Guide.

For more information about using a Web service as the data source for a DataWindow, see the chapter on defining DataWindow objects in the DataWindow Designer User’s Guide.

Using a Web service to update a database

You can use a DataWindow with a Web service data source to update a database. Support for updating data requires one or more WSDL files that describe methods and parameters that can be called by the DataWindow engine for insert, delete, or update operations.

Generating or selecting an assembly The WSDL files are not required on runtime computers. They are used to generate assembly files that are deployed with the application. If you have an existing assembly file that allows you to update data in your DataWindow objects, you can select that assembly instead of generating a new one from the Web Services Update dialog box. You can generate or select separate assemblies for insert, delete, and update operations.

Insert, delete, and update operations The insert, delete, and update operations imply different things depending on the data source. When you insert a DataWindow row for an RDBMS, a new row is added to the database; when the data source is an array of structures, a new structure instance is added to the array; and when the data source is an array of simple types, a new instance of the simple type is added to the array. The delete operation removes a database row or an instance in an array, and the update operation modifies a database row or an instance in an array.

For each operation, you must map DataWindow column values to Web service input parameters. At runtime when performing one of these operations, the DataWindow binds column values to parameters as instructed and calls the Web service method. The DataWindow engine does not know what actually happens in the Web service component (that is, how the component implements the update), only whether it returns a success or failure message.

You set values to bind to Web service parameters in the Web Service Update dialog box.

Because a DataWindow with a Web service data source does not pass back failure messages in a return code during retrieve, insert, or update operations, you must use the WebServiceException object to obtain such error information.

For more information about using a Web service to update a database, see the chapter on controlling updates in DataWindow objects in the DataWindow Designer User’s Guide.