Step 2: Creating the Contoso LOB Application Schemas for the Price and Availability Project Using BizTalk Editor
In this step, you generate the schema to use to query the Contoso ERP system for the price and availability of a particular product. You generate this schema by using the Microsoft® SQL Adapter for BizTalk Server.
To update the SQL stored procedure for schema generation
Click Start, point to All Programs, point to Microsoft SQL Server 2008 R2, and then click SQL Server Management Studio.
In the Microsoft SQL Server Management Studio, expand Databases, expand Contoso, expand Programmability, and then expand Stored Procedures.
Right-click dbo.SP_GetInventoryForProductID, and then click Modify.
In the query window, insert a comma, a space, and then "xmldata" immediately following "for xml auto". The line of code should be the following:
for xml auto, xmldata
Click Execute to save the changes to the stored procedure.
Note
Leave the Microsoft SQL Server Management Studio open for the next procedure.
To create the Contoso Price and Availability schema
Open the Contoso solution in Visual Studio.
In Solution Explorer, right-click the ContosoPriceAndAvailability project, point to Add, and then click Add Generated Items.
In the Add Generated Iems dialog box, with Add Adapter Metadata selected in the left pane, click Add Adapter Metadata in the right pane, and then click Add.
On the Add Adapter Wizard page, select SQL from the list of registered adapters, and then click Next.
On the Database Information page, click Set.
In the Data Link Properties dialog box, in the Select or enter a server name box, type localhost. Select Use Windows NT Integrated security. For Select the database on the server, select the Contoso database from the database list. Click OK.
On the Database Information page, click Next.
On the Schema Information page, do the following:
Use this To do this Target namespace Type http://contoso.com/Price
.Select the port type Select Send port. Request document root element name Type rootPriceRequest. Response document root element name Type rootPriceResponse. Click Next.
On the Statement type information page, select Stored Procedure, and then click Next.
On the Statement Information page, for <Select a stored procedure>, select SP_GetInventoryForProductID from the drop-down list. Click Generate, and then click Next.
On the Completing the SQL Transport Schema Generation Wizard page, click Finish to import the schema into the ContosoPriceAndAvailability BizTalk project.
In Solution Explorer, right-click the generated schema (SQLService_Price.xsd), click Rename, and type ContosoPriceAndAvailability.xsd as the new name for the schema. Click Enter.
In the Properties window for the ContosoPriceAndAvailability schema, set the Type Name property to ContosoPriceSchema.
By default, BizTalk Server creates a BizTalk orchestration named BizTalk Orchestration.odx. Right-click this orchestration, and then click Delete because you do not need this orchestration. In the popup indicating that the orchestration will be deleted permanently, click OK.
In the Microsoft SQL Server Management Studio, remove the
xmldata
predicate and the comma from theSP_GetInventoryForProductID
stored procedure that you added in the previous step, and then click Execute.