Creating the Inventory Web Service - XML

You will create the Inventory Web service that allows online access to up-to-date inventory information of the stock at the headquarters of JB Book Sellers. This Web service simply needs to retrieve some data from an SQL Server 2000 database and make it accessible online. You will construct the Web service by using the tools available with the SQL XML 3.0 pack.

Creating the Database

The database at the head office of JB Book Sellers contains the InventoryData table, as shown in Figure.

The InventoryData Table.

The InventoryData Table.

The InventoryData table maintains an inventory of the available stock. After creating the database, the next step is to create a stored procedure, GetInventory, which retrieves the inventory information from the table.

You use the SQL Server 2000 Enterprise Manager to create the following stored procedure: CREATE PROCEDURE DBO.GetInventory AS

Select Title,Category,Author,Price,Stock from InventoryDataGO

Creating the Web Service for JB Book Sellers

After you create the database and the stored procedure, create a Web service to expose the stored procedure. You learned the steps to create Web service in the earlier section "Creating a Web Service."

After you have finished the steps, you will find that the following files have been created:

  • Inventory.wsdl
  • InVentory.ssc

The WSDL file contains the description of the Web service required by client applications and maps the methods exposed by the Web service to the corresponding stored procedures. To do this, an .ssc file is generated. The following code is a sample .ssc file that connects the Web service to the stored procedure:

This creates the Web service. You can test it by creating a client application in Visual Basic 6.0, as discussed in the section, "Testing the Web Service."

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

XML Topics