431.chapter12.Working with HTTP Endpoints

chapter13.HTTP Endpoint

I understanding HTTP Endpoint Security
1 sever layers of HTTP Endppint Security
(1) Endpoint type--TCP/HTTP(s)
(2) Endpoint payload--the particular subset of traffic that the endpoint allows. TSQL, SOAP, SERVICE_BROKER, and DATABASE_MIRRORING
But an HTTP Endpont allows only ont type paylpad---SOAP
(3) Endpint state--STARTED|STOPPED(default state)|DISABLED
(4) Authentication method--Windows authentication or Certificates
(5) Encryption--specify the ports clause to set the communication is in clear text or SSL
(6) Login type--specify the LOGIN_TYPE to set the type of login, Winodws|Mixed
(7) Endpiont permissions--grant the CONNECT permission on the endpoint

II create a secure HTTP Endpoint
1 Create an HTTP Endpoint
(1) use CREATE ENDPONT statement to create an endpoint, including an HTTP endpont.
(2) it includes two section.
    First: sepcify the protocol.
    Second: define the payload.
(3)important paramenter:language_specific_arguments
(4)ALTER ENDPOINT, DROP ENDPOINT

2 Specifying Web Methods
(1) web methods simply expose stored procedures and functions as public method that a web service can call. In the WEBMETHOD portion
of the SOAP payload's language-specific argumens, you map specific stored procedures and fucntions you want to expose in the endpoint
as Web Methods

3 Specifying WSDL support, Schemas, and Namespaces
(1) WSDL: NONE|DEFAULT
(2) Schema, an HTTP endpoint has a default SCHEMA option that can be overridden by a particular WEBMETHOD, if choosen.
if you specify NONE for the SCHEMA,an inline XSD is not retrned in the SOAP request. if you specify the STANDARD, an inline
XSD is returned along with the result set
(3) the SOAP payload enables you to specify an explicit namespace for an HTTP endpoint. the default namespace for each WEBMETHOD

4 Additional SOAP Payload Parmeters
(1) BATCHED options controls whether a connection can isue ad hoc SQL queries against the endpoint.
(2) By enabling SEESIONS support, muitiple SOAP request/response pairs are treated as a single SOAP session.
(3) DATABASE option, the connection to the HTTP endpoint changes context to the database that you specified;otherwise, the
default database defined for the login is used.

5 practise

(1)通过SMO创建HTT Endpoint

ContractedBlock.gif ExpandedBlockStart.gif create http endpoint
CREATE ENDPOINT    sample_endpoint
STATE 
= STARTED
AS HTTP 
(
    PATH
='/httpendpoint',
    AUTHENTICATION
=(INTEGRATED),
    PORTS
=(CLEAR),
    SITE
='servername'
)

FOR SOAP 
(
    WEBMETHOD 
'ListSample' (NAME='CMDB.dbo.sp_http_endpoint_sample'SCHEMA=DEFAULT, FORMAT=ALL_RESULTS),
    WSDL 
= DEFAULT,
    
DATABASE = 'DatabaseName',
    NAMESPACE
='http://temUri.org'
)



(2)测试是否创建成功,访问http://servername/httpendpoint?wsdl
(3)创建一个windows application来发送soap请求
一个下拉列表控件,一个按钮控件,core code

ContractedBlock.gif ExpandedBlockStart.gif SOAP Request Code
 servername.sample_endpoint proxy = new servername.sample_endpoint();
            proxy.Credentials 
= System.Net.CredentialCache.DefaultCredentials;
            
            
object[] results = proxy.ListSample();
            
            
for (int j = 0; j < results.Length; j++)
            {
                
object e1 = results[j];

                
switch (e1.ToString())
                {
                    
case "HttpEndpointApp.servername.SqlRowCount":
                        
// get the row count               
                        break;

                    
case "System.Xml.XmlElement":
                        
// get the xml result
                        XmlElement xmlResult = (XmlElement)results[j];
                        
// transfer the string to dataset
                        DataSet ds = new DataSet();
                        ds.ReadXml(
new MemoryStream(Encoding.GetEncoding("UTF-8").GetBytes(xmlResult.OuterXml)));

                        
// bind data
                        this.comboBox1.DataSource = ds.Tables[0].DefaultView;
                        
this.comboBox1.DisplayMember = "DataTableColumnName";
                        
break;

                    
case "HttpEndpointApp.servername.SqlMessage":
                         
// get the sql message
                        break;
                }
            }

 

6 遗憾的是微软已经说明了,后续版本的Microsoft SQL Server将删除该功能。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值