"CREATE ENDPOINT" Transact-SQL allows us to create Native XML Web services using Transact-SQL. (Refer Books online for details)
The beauty of this example is: neither we create web service project in visual studio, nor we need data access layer to access SQL data. All that we need to do is copy and execute Transact-Sql script on your Sql server which will create desired end point.
Create Native XML Web Service
We will create Native XML Web Service with
1. Virtual directory http://PDesai222/MySqlEndPoint
2. Three web methods
I. Web method 'GetDbInfo' that executes system stored procedure 'sp_helpdb' in master db and lists Sql server databases
II. Web method 'GetSqlLogins' that executes 'xp_loginInfo' system stored proc in master db and lists Sql server login accounts
III. And web method 'GetTableList' that executes 'sp_tables' system tables and returns master db table names
Simplely copy and execute following Sql script on your Sql server which will create desired Native XML Web Service.
Transact-SQL to create My_Sql_EndPoint
Verify Native XML Web Service
Open browser (internet explorer) and type Url http://pdesai222/MySqlEndPoint?wsdl
How to retrieve data using XML Native Web Service?
using pdesai222;
Build and run your web site project and run it. Click command button to make SOAP request to your Navtive XML web service.