2

How can I get authorized to use ..._vti_bin/search.asmx ?

I manage to set up a service reference to the above web service.

Anonymous access is disabled on the Sharepoint port 80 site.

Here is my code in VS 2010:

DocSystemApplication.QueryWebServiceProxy.QueryServiceSoapClient client = new DocSystemApplication.QueryWebServiceProxy.QueryServiceSoapClient();

client.ClientCredentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;

string queryXML = @" ....  ";

System.Data.DataSet dataset = client.QueryEx(queryXML);

This gives the runtime exception:

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

A related question is that the examples I find do not seem to use the "QueryServiceSoapClient" but just "QueryService" ?

Any suggestions would be appreciated. // Lars S

Sam
  • 1,501
  • 3
  • 19
  • 27
Lars S
  • 21
  • 1
  • 2
  • Similar question and answer: http://stackoverflow.com/questions/2608887/sharepoint-web-services-the-http-request-is-unauthorized-with-client-authentic/2609909#2609909 – Kit Menke Oct 15 '10 at 14:13
  • QueryService - that appears to be the SharePoint 2007 approach... whereas QueryServiceSoapClient is the SharePoint 2010 approach. – Eric Burdo Jun 26 '13 at 14:40

1 Answers1

2

I found the answer myself.

In the app.config there is a section security mode="None", and on next line... transport clientCredentialType="None" proxyCredentialType="None" realm=""

I changed this to mode="TransportCredentialOnly" and ...clientCredentialType="Ntlm" proxyCredentialType="Ntlm" realm=""

and it started working!

We found this suggestion here.

Shoban
  • 22,724
  • 8
  • 60
  • 105
Victor Cassel
  • 191
  • 1
  • 1
  • 5