492 Chapter11•SQLServerXMLSupport FOR SOAP setting Value Description If batches are enabled, ad hoc SQL requests can be executed on the endpoint by calling the sql:sqlbatch method. This method also exposes parameterized query functionality; therefore, it can take an optional list of SqlParameter elements that will describe metadata and values for the parameters of the specified query. Within the query, parameter names starting with the at sign (@) can be embedded. Matching parameter names must be supplied; otherwise, an error is returned for the request. LOGIN_TYPE { MIXED | WINDOWS } Specifies the SQL Server Authentication mode for the end- point. If LOGIN_TYPE is not speci- fied, the default is WINDOWS. LOGIN_TYPE can only be used to further restrict the authentication mode for endpoints that are based on the server global authentication mode that was selected when the instance of SQL Server was installed. MIXED Allows either SQL Server Authentication or Windows Authentication to be used to authenticate endpoint users. If MIXED is specified and the server is installed in Windows Authentication mode, an error is returned. When set to MIXED, SQL Server Authentication is supported on the endpoint, and the endpoint must be configured to use a Secure Sockets Layer (SSL) port. Table 11.4 Continued. Settings Available for the FOR SOAP Clause Continued SQLServerXMLSupport•Chapter11 493 FOR SOAP setting Value Description WINDOWS Allows only Windows Authentication to be used to authenticate endpoint users. WSDL { NONE | DEFAULT | ‘sp_name’ } Indicates whether WSDL document generation is supported for this end- point. If NONE, no WSDL response is generated or returned for WSDL queries submitted to the endpoint. If DEFAULT, a default WSDL response is generated and returned for WSDL queries submitted to the endpoint. In exceptional cases, where you are implementing custom WSDL sup- port for the endpoint, you can also specify stored procedures by name that will return a modified WSDL document. SESSIONS { ENABLED | DISABLED } Specifies whether the instance of SQL Server allows sessions support. If set to ENABLED, SQL Server allows sessions support, whereby multiple SOAP request/response message pairs can be identified as part of a single SOAP session. The default is DISABLED. SESSION_TIMEOUT TimeoutInterval Specifies time in seconds (as an integer) that is available before a SOAP session expires at the server when no further requests are received. The default is 60 seconds. This overrides the time-out value specified in the SOAP session header. Table 11.4 Continued. Settings Available for the FOR SOAP Clause Continued 494 Chapter11•SQLServerXMLSupport FOR SOAP setting Value Description The time-out time that is initialized when the server finishes sending a SOAP response message to the client. If the time-out elapses before another SOAP request with the same session ID specified in its header, the session is terminated at the server. DATABASE { ‘database_ name’ | DEFAULT } Specifies the database in the context of which the requested operation is executed. If database_name is not specified or if DEFAULT is specified, the default database for the login is used. NAMESPACE { ‘namespace’ | DEFAULT } Specifies the namespace for the endpoint. If namespace is not speci- fied or if DEFAULT is specified, the assumed namespace is http://tempuri. org. You can overwrite the default namespace when you specify a specific method by using WEBMETHOD ‘namespace’namespace. SCHEMA { NONE | STANDARD } Specifies whether an XSD schema is returned by the endpoint when SOAP results are sent. NONE Omits inline schema from SOAP responses. STANDARD Includes inline schema in endpoint responses. CHARACTER_SET { SQL | XML } Defines the behavior when the result of an operation includes char- acters that are not valid in XML. The default is XML. Table 11.4 Continued. Settings Available for the FOR SOAP Clause Continued SQLServerXMLSupport•Chapter11 495 To ensure that your endpoint is configured correctly, you can submit an HTTP request to the server. You can do this by opening your web browser and navigate to http://w2k3srvr/thresholds?wsdl. If the endpoint is responding, it will return the WSDL for your service. The screen shot in Figure 11.11 is the web reference dialog box from Visual Studio 2005. You will see that in the address bar, you typed in your URL (http:// w2k3srvr/thresholds?wsdl), and it returned your method, Thresholds, which you specified in the WEBMETHODS setting in your CREATE ENDPOINT statement. FOR SOAP setting Value Description SQL Encodes the characters that are not valid as character references, and then returns them in the result. In this case, an XML parser may reject the returned XML as not valid. XML Encodes characters according to the XML specification. Any characters that are not allowed in the XML character set will cause SQL Server to send an invalid XML error back to the client. HEADER_LIMIT N/A Specifies the maximum size, in bytes, of the header section in the SOAP envelope. If the SOAP headers don’t fit in this size, the server generates a parsing error. If not specified, a default value of 8 KB (8192 bytes) is assumed. Table 11.4 Continued. Settings Available for the FOR SOAP Clause 496 Chapter11•SQLServerXMLSupport Figure 11.11 Add Web Reference Dialog Box in Visual Studio 2005 Web Services Web Services is a simple platform-independent message framework that runs as a web service and is accessed by web platform elements such as SOAP, UDDI, and WSDL. Web Services uses XML as a base language so that a web service can be written in C++, VB.NET, or C#. Web Services is based on established HTTP protocols for transmitting messages. This is a major advantage if you want to build an Internet-scale application because most of the Internet’s proxies and firewalls won’t interfere with HTTP traffic. So how does this all actually work? For example, let’s say you own one of the biggest auction sites in the world and you want to expand your business to allow open-source developers to create open-source software that retrieves listings of auctions. You don’t want to give them direct database access or have to maintain a set of APIs, so you create a web service. This web service contains functions that perform queries against your database. The open-source developer would call this . global authentication mode that was selected when the instance of SQL Server was installed. MIXED Allows either SQL Server Authentication or Windows Authentication to be used to authenticate. is specified and the server is installed in Windows Authentication mode, an error is returned. When set to MIXED, SQL Server Authentication is supported on the endpoint, and the endpoint must. for the end- point. If LOGIN_TYPE is not speci- fied, the default is WINDOWS. LOGIN_TYPE can only be used to further restrict the authentication mode for endpoints that are based on the server