SA0221 : The FOR SOAP option in CREATE/ALTER ENDPOINT statement is deprecated

The deprecated FOR SOAP option in CREATE or ALTER ENDPOINT statements can cause compatibility issues with future SQL Server versions.

Description

With the release of SQL Server 2012, Native XML Web Services (SOAP/HTTP endpoints) support was removed, rendering FOR SOAP options obsolete. T-SQL scripts that still utilize this functionality may encounter compatibility issues when upgrading or maintaining SQL Server systems.

For example:

SQL
 1-- Problematic endpoint creation using FOR SOAP
 2CREATE ENDPOINT SqlEndpoint
 3STATE = STARTED
 4AS HTTP
 5(
 6    PATH = '/sql'
 7)
 8FOR SOAP
 9(
10    WEBMETHOD 'Add'
11    (name='MyNamespace.MyStoredProcedure'),
12    BATCHES = ENABLED,
13    WSDL = DEFAULT,
14    LOGIN_TYPE = MIXED
15);

This example attempts to create a SOAP endpoint, a feature that is no longer supported by SQL Server starting from version 2012. As a result, the script will fail to execute in these newer environments.

  • Using deprecated features can lead to system incompatibility and maintenance challenges.

  • It can also increase the risk of security vulnerabilities due to reliance on outdated technologies.

`

How to fix

Avoid using the deprecated FOR SOAP option in CREATE or ALTER ENDPOINT statements as it is not supported in SQL Server versions 2012 and later.

Follow these steps to address the issue:

  1. Identify any CREATE ENDPOINT or ALTER ENDPOINT statements using the FOR SOAP option in your existing T-SQL scripts.

  2. Remove the FOR SOAP option from these statements. SOAP endpoints are not supported after SQL Server 2012, and any functionality relying on SOAP should be refactored to use other supported communication methods such as REST APIs.

  3. Test your modified scripts to ensure that they execute correctly without the FOR SOAP option and that all functionality is preserved using the new methods.

For example, the following T-SQL code illustrates the removal of a deprecated FOR SOAP option:

SQL
1-- Example of corrected endpoint creation without FOR SOAP
2-- Note: Implement alternative communication methods, as SOAP is unsupported
3CREATE ENDPOINT SqlEndpoint
4STATE = STARTED
5AS HTTP
6(
7    PATH = '/sql'
8);

Scope

The rule has a Batch scope and is applied only on the SQL script.

Parameters

Rule has no parameters.

Remarks

The rule does not need Analysis Context or SQL Connection.

Effort To Fix
8 hours per issue.
Categories

Deprecated Features, Bugs

Additional Information
Example Test SQL
SQL
 1CREATE ENDPOINT FooEndpoint
 2STATE = Started
 3AS HTTP
 4(
 5    PATH = '/Foo',
 6    AUTHENTICATION = (INTEGRATED),
 7    PORTS = (CLEAR), CLEAR_PORT = 8080,
 8    SITE = '*'
 9)
10FOR SOAP
11(
12    WEBMETHOD 'FooMethod'(NAME = 'FooDatabase.FooSchema.uspFoo'),
13    WSDL = DEFAULT,
14    DATABASE = 'FooDatabase',
15    NAMESPACE = DEFAULT
16);
17
18ALTER ENDPOINT FooEndpoint
19FOR SOAP
20(
21    ADD WEBMETHOD 'Foo2Method'(NAME = 'FooDatabase.FooSchema.uspFoo2')
22);

Analysis Results
  Message Line Column
1 SA0221 : The FOR SOAP option in CREATE/ALTER ENDPOINT statement is deprecated. 10 4
2 SA0221 : The FOR SOAP option in CREATE/ALTER ENDPOINT statement is deprecated. 19 4
See Also

Other Resources