Use SQLXML 3.0 (Web Services, XML Views, Managed Classes) [1]

zhaozj2021-02-17  87

Use SQLXML 3.0 (Web Services, XML Views, Managed Classes)

Mood

2002-5-25

Article Type: Overview

Difficult Level: 5/9

Version: 4.16

When Web Services is not only a new technique, but also as an integration of existing technologies; it began to affect the development of some fields, especially IBM, Microsoft companies believe that when enterprises establish web services applications, Start from the internal application of the company, then extend to the common web services. So the product lines of the two companies do not hesitate to transfer and support the Web Services direction, like WebShpere, Tivoli, Lotus, Commerce Server, BizTalk Server, constantly improve and provide support for Web Services.

The core of Web Services is XML technology. At present, both IBM, Oracle and Microsoft have enhanced XML-based database products; and use a similar XML Extender to handle the exchange between XML and relational databases, which makes Pure XML database supporters are almost desperate. Compared to Oracle's XDB is the most impressive. Microsoft has already supported XML when publishing SQL Server 2000. The SQLXML 3.0 released later is an enhancement of it. But when a stored procedure can be easily converted into a Web Services method, I don't know how to evaluate the SQLXML itself.

Due to the release of SQL Server 2000, there is no Web Services, and the support of XML in SQL Server 2000 is not all the latest W3C standards, so SQLXML is more like a patch, but some characteristics are very prominent:

1. Support for Web Services (SOAP).

2. Use HTTP to access multiple ways of SQL Server.

3. Define mapping files while supporting W3C standard Annotated XSD Schemas and the original Annotated XDR Schemas

4. SQLXML's DOTNET support allows you to access XML data on SQL Server 2000 using SQLXML Managed Classes

Let's take a look at these features one by one:

Support for Web Services

Simplely said that this feature allows customers to issue a SOAP / HTTP request to SQL Server 2000, request a stored procedure, custom function, and template on SQL 2000, and SQL Server can give the customer corresponding results (response). It is also very simple to step, it is two steps:

1. First define a stored procedure, custom function

Stored procedure: sp_getEmployees CREATE PROCEDURE sp_getEmployees @EmployeeID int AS select * from Employees where EmployeeID = @EmployeeID GO custom functions: Add and getemployeesByID CREATE FUNCTION [Add] (@a int, @b int) RETURNS int AS BEGIN return (@a @b) END CREATE fUNCTION [getEmployeesByID] (@EmployeeID int) RETURNS table AS RETURN (Select * from Employees Where EmployeeID = @EmployeeID) Insurance, we will test our stored procedures and custom functions in Query analyzer in.

Exec sp_geetemployees 1 select * from [northwind]. [dbo]. [getEmployeesbyid] (1) SELECT [Northwind]. [dbo]. [add] (1, 3)

2. Use the IIS Virtual Directory Management to create Virtual Directory and Virtual Name and configure.

(Create a NorchWind virtual directory)

(Set the virtual name attribute of this directory, create a name (name): WebGet, Type: SOAP)

(Click the configure button, appear in the configuration page, enter the method name (Method Name, then click ...)

(A list of stored procedures and custom functions, after selecting .SP indicates stored procedures, UDF is a custom function)

When we choose SOAP's function, you can have another setup window. This Configuration allows us to make some more detailed settings, mainly ROW FORMATTING and OUTPUT AS options, what will these settings do different effects? From the following we produce the Web Services's proxy code to see some:

XML Objects mode may be like this:

Public Object [] sp_getemployees (int EmployeeID) {

Object [] results = this.invoke ("sp_geetemployees", new object [] {

Employeeid});

Return ((Object []) (Results [0]));

}

DataSet Objects is this code:

Public system.data.dataset getEMPloyeesbyid (int urgeeeid) {

Object [] results = this.invoke ("getEmployeesbyid", new object [] {

Employeeid});

Return ((System.Data.DataSet) (Results [0]));

}

Then we entries http: // localhost / northmind / webget? WSDL (some strange URLs, but we can work), we can use other Web Services. Here to save the specific test example code.

We can see that from a stored procedure or even a custom function, we can directly become an interface or method in a WebServices. I want to comment for this feature, but it provides a way to make you Using XML organizations and access your data, the most important thing is to support the SOAP / HTTP protocol. Thus, Database Server is no longer simple to be a data layer, so it may be more loosely coupled on the application architecture. Of course, this technique using SQLXML will be too straightforward. Perhaps it is more in the enterprise, it is impossible to believe You or I will put it directly on the Internet. However, this is a good starting point, which can be combined with other techniques or functions to get higher applications, so I think the database is necessary for SOAP / HTTP support. In the future it may become a certain amount of Database. index. Ok, let's take a look at the next feature, here we will look at some more content about SQLXML, but many of them are from HTTP access and XML support features when SQL 2000 is released.

Special Note:

This article original, 9CBS signature start, all text and photo copyright. Do not propagate, reprint, or adaptation without authorization.

If you have any questions or suggestions, please email new2001@msn.com

转载请注明原文地址:https://www.9cbs.com/read-30990.html

New Post(0)