Databases Reference
In-Depth Information
Therefore, you should understand what Web services are, be aware of
exactly what support your database is including for Web services, and evalu-
ate what you can safely use versus enabling access to everything.
7.4.1
XML Web services for SQL Server 2005
SQL Server 2005 supports Web services extensively and probably has the
most functional such model today. In fact, anything you've been used to
with traditional clients can now be performed using a Web services inter-
face. Any types of queries and calls to stored procedures that were possible
in versions before 2005 using the Tabular Data Stream (TDS) over TCP/
IP, Named Pipes, or other protocols are now possible as SOAP over HTTP
(over TCP/IP).
To set up this capability you need to create HTTP endpoints within
SQL Server 2005. Endpoints expose server functions as HTTP listeners.
For example, to expose a procedure called FOO in the master database as a
Web service that will be called using a URL of the form http://<host>/
sql/foo , use the following DDL command. This is similar to the way you
define webmethods when creating Web services from VB or C# methods in
Visual Studio .NET:
CREATE ENDPOINT FOO_ENDPOINT
STATE=STARTED
AS HTTP (
AUTHENTICATION=(INTEGRATED),
PATH='/sql/foo',
PORTS=(CLEAR)
)
FOR SOAP (
WEBMETHOD
'http://tempura.org'.'foo'
(NAME='master.dbo.FOO'),
BATCHES=ENABLED,
WSDL=DEFAULT
)
Web methods have been successful in Visual Studio .NET, and their
success is now being replicated within SQL Server.
You can inspect all HTTP endpoints using master.sys.http_endpoints .
Once the endpoint is defined, you need to activate it by giving connection per-
missions. This looks similar to grants on a procedure:
 
Search WWH ::




Custom Search