9

I am trying to access list information on MOSS 2007 using web services.

SppLists.ListsSoapClient proxy = new SurveyMerge.SppLists.ListsSoapClient();
proxy.ClientCredentials.Windows.AllowNtlm = true;
proxy.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.None;
proxy.ClientCredentials.Windows.ClientCredential = (System.Net.NetworkCredential)System.Net.CredentialCache.DefaultCredentials;
XmlNode node = proxy.GetListCollection();

I get the following error message:

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

What must I do to authenticate the request?

1 Answer 1

9

I thinnk I found the solution.

In app.config set security mode to TransportCredentialOnly and transport clientCredentialType to Ntlm. See snippet below.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="ListsSoap" closeTimeout="00:01:00" openTimeout="00:01:00"
                receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
                bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                useDefaultWebProxy="true">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <security mode="TransportCredentialOnly">
                    <transport clientCredentialType="Ntlm" proxyCredentialType="None"
                        realm="" />
                    <message clientCredentialType="UserName" algorithmSuite="Default" />
                </security>
            </binding>
2
  • 1
    If you think this is the solution then mark it as the answer to the question. That way everyone knows. Mar 4, 2010 at 21:55
  • Charles - I wanted to but didn't have the rep to do it. I have done it now. Thanks to those who voted me up :-)
    – paul
    Mar 8, 2010 at 7:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.