none
Problem to connect to SOAP Endpoint RRS feed

  • Question

  • Hi,

    I have created the following endpoint on a SQL Server 2005 instance:

     

    CREATE ENDPOINT SQLEP_ExecuteSQL

           STATE = STARTED

       AS HTTP

       (

           PATH = '/iSQLQuery',

           AUTHENTICATION = (KERBEROS),

           PORTS = (CLEAR),

           SITE = 'olagru_lap',

           CLEAR_PORT = 8088

       )

       FOR SOAP

       (

           WEBMETHOD 'epExecuteSQL'

               (NAME='isqlquery.dbo.ExecuteSQL'),

           BATCHES = DISABLED,

           WSDL = DEFAULT,

           DATABASE = 'isqlquery',

           NAMESPACE = 'http://ogsoft/iSQLQuery'

       )

     

     

    Now I try to coonect to the endpoint and execute the method using Visual Studio 2010, WPF and C#.

    I have sucessfully create a service reference in my C# project.

    But when I call the method I get the following error:

    The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was ''.

    Here is my .NET code:

    SQLEP_ExecuteSQLSoapClient proxy = new SQLEP_ExecuteSQLSoapClient();

    proxy.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation;

    proxy.ChannelFactory.Credentials.Windows.ClientCredential =

                    CredentialCache.DefaultNetworkCredentials;

    proxy.epExecuteSQL();

     

    I have also tried:

     

    proxy.ClientCredentials.Windows.ClientCredential.Domain = "domain";

    proxy.ClientCredentials.Windows.ClientCredential.UserName = "user";

    proxy.ClientCredentials.Windows.ClientCredential.Password = "password";

     

    with the same effect.

    I am running Windows 7 and the SQL Server and Visual Studio are running on the same machine.

     

    I hope someone can help me with this.

     

    Many thanks

     

    Olaf

     

     

    • Moved by Bob BeaucheminEditor Tuesday, April 27, 2010 12:00 AM Moved to a more relevent forum (From:.NET Framework inside SQL Server)
    Monday, April 26, 2010 8:24 PM

All replies

  • Hi,

    if I change to AUTHENTICATION = (INTEGRATED)

    I get the following error:

    The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'.

    Monday, April 26, 2010 8:33 PM
  • Hi Olaf,

    This forum is for questions about SQLCLR code, that is, stored procedures, triggers, UDFs, UDTs, UDAggs written in a .NET language. Are you trying to connect to HTTP endpoint for a .NET procedure? If not, I'll move the question to the SQL Server Data Access forum in a few minutes, where it would be on-topic.

    Meanwhile, are you aware of the fact that SQL Server HTTP Endpoints are deprecated in SQL Server 2008. Although they still work in SQL Server 2005 and 2008, they're no guarentee they'll be supported going forward.

    Also, did you try taking out this line referring to AllowedImpersonationLevel in the client? I have working code that looks similar (albeit on Windows Server 2003) except for that line of code.

    Cheers, Bob Beauchemin, SQLskills

     

    Monday, April 26, 2010 8:45 PM
    Answerer
  • Under which account you are running your application? Is it a service? Thanks.
    Thursday, April 29, 2010 9:57 PM
    Moderator