Udostępnij za pośrednictwem


Readme_XmlOnlineCatalog

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

  • CatalogDescription column of xml type in the Production.ProductModel table
  • LargePhoto column in the Production.ProductPhoto table

This sample is not supported on Windows 2000 and earlier operating systems.

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

Samples are provided for educational purposes only. They are not intended to be used in a production environment and have not been tested in a production environment. Microsoft does not provide technical support for these samples. Sample applications and assemblies should not be connected to or used with your production SQL Server database or your report server without the permission of the system administrator.

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, and is also available at the SQL Server Developer Web site.
  • The SQL Server 2005 Database Engine samples. These samples are included with SQL Server 2005. You can download the latest version of the samples at the SQL Server Developer Web site.
  • .NET Framework SDK 2.0 or Microsoft Visual Studio 2005. You can obtain .NET Framework SDK free of charge. For more information, see Installing the .NET Framework SDK.

Building the Sample

If you have not already created a strong name key file, generate the key file using the following instructions.

To generate a strong name key file

  1. Open a Microsoft Visual Studio 2005 command prompt. Click Start, point to All Programs, point to Microsoft .NET Framework SDK 2.0, and then click SDK Command Prompt.

    -- or --

    Open a Microsoft .NET Framework command prompt. Click Start, point to All Programs, point to Microsoft .NET Framework SDK 2.0, and then click SDK Command Prompt.

  2. Use the change directory command (CD) to change the current directory of the command prompt window to the folder where the samples are installed.

    Note

    To determine the folder where samples are located, click the Start button, point to All Programs, point to Microsoft SQL Server, point to Documentation and Tutorials, and then click Samples Directory. If the default installation location was used, the samples are located in <system_drive>:\Program Files\Microsoft SQL Server\100\Samples.

  3. At the command prompt, run the following command to generate the key file:

    sn -k SampleKey.snk

    Important

    For more information about the strong-name key pair, see "Security Briefs: Strong Names and Security in the .NET Framework" in the .NET Development Center on MSDN.

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 run the scripts\install.sql script, or run 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 Windows Explorer, right-click 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. Compile the application by using the provided Microsoft Visual Studio solution, or run the following at a .NET Framework or Microsoft Visual Studio 2005 command prompt:

    msbuild /nologo /verbosity:quiet /property:Configuration=Debug CS\ xmlonlinecatalog.sln

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 by using SQL Server Management Studio and run the contents of the file. Or, run the following command at the command prompt:

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

Comments

See Also

Concepts

XML Samples

Help and Information

Getting SQL Server 2005 Assistance

Change History

Release History

5 December 2005

Changed content:
  • Changed instructions for generating a key file, including the name and location of the key file.