开发者

Why does Sharepoint 2010 Web Reference work, but Service Reference does not

Sharepoint is setup to use NTLM authentication.

When I reference http://myserver/Sites/Ops/_vti_bin/Lists.asmx?WSDL as a Web Reference, I can call the methods and get valid responses.

When I reference the same url as a Service Reference, the server throws an exception when calling methods.

My account is admin on the Sharepoint Farm.

This is the app.config for the service reference (mostly auto generated):

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
    </configSections>
    <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="65开发者_开发问答536" 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" />  
                  </security>
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://myserver/Sites/Ops/_vti_bin/Lists.asmx"
                binding="basicHttpBinding" bindingConfiguration="ListsSoap"
                contract="SharepointLists.ListsSoap" name="ListsSoap" />
        </client>
    </system.serviceModel>
</configuration>

Saddly, the only information the exception provides is this:

"Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown."

No other details.

The code that I'm using is:

 public ListClass()
    {

        _Client = new SharepointLists.ListsSoapClient();

    }

    public System.Xml.Linq.XElement GetTaskList()
    {
        return _Client.GetList("Tasks");

    }

Any thoughts? I would like to use the Service Reference rather than the Web Reference.

UPDATE:

I tried Rob's suggestion and got this error:

HTTP GET Error
    URI: http://myserver/Sites/Ops/_vti_bin/Lists.asmx

    The document at the url http://myserver/Sites/Ops/_vti_bin/Lists.asmx

was not recognized as a known document type. The error message from each known type may help you fix the problem: - Report from 'http://myserver/Sites/Ops/_vti_bin/Lists.asmx' is 'The document format is not recognized (the content type is 'text/html; charset=utf-8').'. - Report from 'DISCO Document' is 'There was an error downloading 'http://myserver/_vti_bin/Lists.asmx?disco'.'. - The request failed with HTTP status 404: Not Found. - Report from 'WSDL Document' is 'The document format is not recognized (the con tent type is 'text/html; charset=utf-8').'. - Report from 'XML Schema' is 'The document format is not recognized (the conten t type is 'text/html; charset=utf-8').'.


The Add Service Reference dialog does not generate the proper configuration for an ASMX service. You need to use svcutil instead.

This blog post should help you http://nayyeri.net/integrating-wcf-clients-with-asmx-services

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜