2011-08-31 29 views
0

钍下面的代码是给“Microsoft.SharePoint.SoapServer.SoapServerException”试图打电话的时候走走Microsoft.SharePoint.SoapServer.SoapServerException“SharePoint列表服务

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); 
     } 
    } 

有什么不对的代码,还是应该我需要更改任何配置。在客户端或服务器端。 谢谢。

回答

0

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

+0

处理后也出现同样的错误。我没有在我的机器上安装sharepoint,有没有这样做的错误或错误处理? – Flowerking

0

尝试使用Fiddler,这将帮助您查看Soap请求内部发生了什么。

+0

试过小提琴手,这是来自服务器的回应。 [来自服务器的XML响应](http://inky.ws/g/j8)发送的请求与预期一致,并且请求没有错误。谢谢。 – Flowerking