The XMLOnlineCatalog sample application displays information about particular products. This sample retrieves information from the following columns in the SQL Server AdventureWorks database:

The default installation directory is drive:\Program Files\Microsoft SQL Server\90\Samples\Engine\XML\XmlOnlineCatalog.

Scenario

A developer wants to retrieve XML-based descriptions of products from a Web service hosted by SQL Server.

Languages

Transact-SQL, XML, XSD, XSLT, Visual C#, and Visual Basic.

Features

The XmlOnlineCatalog sample uses the following features of SQL Server 2005:

Application Area Features

Overall

XML, SQL Server-hosted Web services

Prerequisites

Before running this sample, make sure the following software is installed:

  • SQL Server 2005 or SQL Server 2005 Express Edition. You can obtain SQL Server Express free of charge from the SQL Server Express Download site.

  • The AdventureWorks database, which is included with SQL Server 2005. This database is also available to download at the SQL Server Express Download site.

  • The SQL Server 2005 Database Engine samples. These samples are included with SQL Server 2005, and are also included with the Microsoft .NET Framework SDK 2.0.

  • .NET Framework SDK 2.0 or Microsoft Visual Studio 2005. You can obtain .NET Framework SDK free of charge. See Installing the .NET Framework SDK.

Building the Sample

To build the sample, do the following:

Build the sample

  1. Ensure that the AdventureWorks sample database is installed.

  2. In SQL Server Management Studio, load and execute the scripts\install.sql script, or execute the following command at the command prompt:

    sqlcmd -E -I -i Scripts\install.sql

    This script creates the following:

    • GetProductDescription stored procedure

    • sql_ProductCatalog HTTP Endpoint

  3. In Microsoft Windows Explorer, right-click right the CS\XmlOnlineCatalog folder where the sample was installed, click Properties, click the Web Sharing tab, click the Share this folder option, and then click OK twice. This creates an IIS virtual folder for the sample that will enable the application to work correctly.

  4. CD to the install directory and execute the following at a .NET Framework or Microsoft Visual Studio 2005 command prompt:

    sn -k keypair.snk

  5. Compile the application using the provided Microsoft Visual Studio solution, or execute the following at the command prompt:

Running the Sample

To run the sample, do the following:

Run the sample

  1. Run the CS\XmlOnlineCatalog\bin\debug\XmlOnlineCatalog.exe application.

  2. Enter 19 for the ProductModelID value and click Show Description. For information about the format of the SOAP request, click Show Request. For information about the format of the SOAP response from SQL Server 2005 click Show Response. For information about the XSLT file that rendered the instructions, click Show XSL. You can search the ProductModel table to find other ProductModelID values for which the catalog description XML is stored.

Removing the Sample

To remove the sample, do the following:

Remove the sample

  1. Open the Scripts\Cleanup.sql file using SQL Server Management Studio and execute the contents of the file, or execute the following command at the command prompt:

    sqlcmd -E -I -i Scripts\cleanup.sql

Comments