Readme_XmlManuInstructions Sample

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

This sample works only with SQL Server 2005 and SQL Server 2008. It will not work with any version of SQL Server earlier than SQL Server 2005.

The XMLManuInstructions sample application displays online directions for building products. The data for this application is retrieved from the following columns in the Microsoft SQL Server AdventureWorks database:

  • Instructions column of XML type in Production.ProductModel table
  • Diagram column of XML type in the Production.Illustration table

Default Location:

C:\Program Files\Microsoft SQL Server\100\Samples\Engine\XML\XmlManuInstructions.

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 create an application which accesses XML-based manufacturing directions from a web service and displays them.

Languages

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

Features

The XmlManuInstructions sample uses the following features of SQL Server.

Application Area Features

Overall

XML, SQL Server-hosted web services

Prerequisites

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

  • Microsoft SQL Server or Microsoft SQL Server Express (SQL Server Express). You can obtain SQL Server Express free of charge from the SQL Server Express Documentation and Samples Web site.
  • The AdventureWorks2008R2 database that is available at the SQL Server Developer Web site.
  • The SQL Server Database Engine samples that are available 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. See Installing the .NET Framework Documentation.

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 you need to do the following:

Build the sample

  1. Make sure 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 in a command prompt window:

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

    This script creates the following:

    • GetManuInstructions stored procedure.
    • sql_AdvWorksEndPointManuInstrucions HTTP Endpoint.
  3. In Windows Explorer, right-click the CS\XmlManuInstructions folder where the sample was installed, click Properties, click the Web Sharing tab, select Share this folder, and then click OK twice. This creates an IIS virtual folder for the sample, which enables the application to work correctly.

  4. Install the SVG viewer from the Adobe Web site. Be sure to click Save As instead of Open.

    Note

    To install the viewer, you must have administrator privileges on your computer. Follow this procedure to install the viewer in the administrator context without having to log out of your current session.

    1. From the Run menu, type the following command: runas /user:Administrator cmd.
    2. At the prompt, enter the Administrator password.
    3. In the command shell, type the path to the svgview.exe file and press ENTER, such as C:\downloads\svgview.exe.

    Note

    Even if your user account has administrator privileges, you must run the installer on the account named “Administrator” or it does not work.

  5. Build the application using Microsoft Visual Studio 2005, or type the following in a .NET Framework or Microsoft Visual Studio 2005 command prompt window:

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

Running the Sample

To run the sample you need to do the following:

Run the sample

  1. Run CS/XmlManuInstructions/bin/debug/XmlManuInstructions.exe.

  2. Enter 7 for Product Model ID value. Click Show Instructions to see the fully rendered manufacturing instructions for the specified model. If you are curious about the format of the SOAP request, Click Show Request. If you are curious about the format of the SOAP response from SQL Server click Show Response. If you are curious about the XSLT file which rendered the instructions, click Show XSL. You can search the ProductModel table to find ProductModelID values for which products have XML manufacturing instructions stored.

Removing the Sample

To remove the sample, to do the following:

Remove the sample

  1. Open the Scripts\cleanup.sql file in Management Studio and run the contents of the file. Or, run the following command in a command prompt window: sqlcmd -E -I -i Scripts\cleanup.sql

Comments

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.