尝试调用sharepoint Lists Service时获取“Microsoft.SharePoint.SoapServer.SoapServerException”

时间:2011-08-31 13:07:22

标签: c# wcf sharepoint soap service

以下代码提供了“Microsoft.SharePoint.SoapServer.SoapServerException”

    public class SP_Access
    {
        ListsSoapClient _proxy;
        XElement _lists; 

        public SP_Access()
        {
            _proxy = new ListsSoapClient();

            //authenticcation
            _proxy.ClientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential();

            //Define the parameters for the service call
            XElement query = new XElement("Query");
            XElement queryOptions = new XElement("QueryOptions");
            XElement viewFields = new XElement("ViewFields",
                                        new XElement("FieldRef", new XAttribute("Name", "Employer")),
                                        new XElement("FieldRef", new XAttribute("Name", "Address")));

            _lists = _proxy.GetListItems("Search Files",
                    null,
                    query,
                    viewFields,
                    null,
                    queryOptions,
                    null);
        }
    }

代码有什么问题,或者我是否需要更改任何配置。在客户端或服务器端。 感谢。

2 个答案:

答案 0 :(得分:0)

Microsoft.SharePoint.SoapServer.SoapServerException是一个通用的soap错误,您需要将您的代码包装在try和catch中以获取正确的异常。

答案 1 :(得分:0)

尝试使用Fiddler,这将帮助您了解Soap Request内部的情况。