0
votes

for days I testing a little Application, which shall be read a SPList by webservice and show the content. Unfortunately it don´t work. I get always the same failure:

System.Web.Services.Protocols.SoapException: Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.

bei System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)

bei System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)

bei NeuerTestWebservice_4_2.webserviceSCC.Lists.GetListItems(String listName, String viewName, XmlNode query, XmlNode viewFields, String rowLimit, XmlNode queryOptions, String webID) in d:\VisualStudio2012\WebserviceTests\NeuerTestWebservice_4_2\NeuerTestWebservice_4_2\Web References\webserviceSCC\Reference.cs:Zeile 455.

bei NeuerTestWebservice_4_2.Form1.btnFill_Click(Object sender, EventArgs e) in d:\VisualStudio2012\WebserviceTests\NeuerTestWebservice_4_2\NeuerTestWebservice_4_2\Form1.cs:Zeile 30.

My webreference looks like this: http://rootwebsite.de/_vti_bin/Lists.asmx?wsdl/soap (ok - at the moment this is one site, but i want choose the website and Lists later) This is my code:

 ...

    private void btnFill_Click(object sender, EventArgs e)
    {
        try
        {
           webserviceSCC.Lists service = new webserviceSCC.Lists();
           service.UseDefaultCredentials = true;

           XmlNode nodes = service.GetList("Inhalts- und Strukturberichte");  //don´t get a failure, if I add "?wsdl/soap" to the Webservice-Referenz ("/_vti_bin/Lists.asmx?wsdl/soap")
           XmlNode listItems = service.GetListItems("Inhalts- und Strukturberichte", "Alle Elemente", null, null, "100", null, null); //here (GetListItems) I get the failure always
          //XmlNode listItems = service.GetListItems("Inhalts- und Strukturberichte", null, null, viewFields, null, null, null);

                    ...
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.ToString());
        }
  }

I had test different webservice-references. Have you an idea, because I get the failure? Have you an good Example for me?

thanks.


thank you. The url I had tested before - there isn´t a change at the failure. I get this failure, too:

Exception:Thrown: "Die Datei oder Assembly "NeuerTestWebservice_4_2.XmlSerializers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden." (System.IO.FileNotFoundException) A System.IO.FileNotFoundException was thrown: "Die Datei oder Assembly "NeuerTestWebservice_4_2.XmlSerializers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden."

directly after initializing of webservice: webserviceSCC_Sys.Lists service = new webserviceSCC_Sys.Lists(); Helps this information?

2
No - it is a sharepoint webserviceRotaney

2 Answers

1
votes

Your parameters for GetListItems() are causing the error. See http://msdn.microsoft.com/en-us/library/websvclists.lists.getlistitems.aspx for examples. According to the documentation the viewName parameter (2nd) should be the Guid of the view, or an empty string for the default view, not the name of the view.

1
votes

Here's a method where I call on two different webservices, it works correctly. I suspect that you need to specify the service.Url property on yours.

(Notice I am using the using statement to correctly dispose the webservices.)

public void TestPermissions(String objectName, String objectType, LoggedInUserDetails userDetails, string siteUrl)
{
    XmlNode perms;
    XmlNode userInfo;
    XmlNode permissions;
    XmlNode rolesFromUser;

    using (SharePermissions.Permissions permissionService = new SharePermissions.Permissions())
    {
        List<object> names = new List<object>();
        permissionService.Credentials = new NetworkCredential(
                userDetails.UserName,
                Decrypt(userDetails.Password, "utrfirfu7j6r" + userDetails.MacAddress));
        permissionService.Url = siteUrl + @"/_vti_bin/Permissions.asmx";

        perms = permissionService.GetPermissionCollection(objectName, objectType);
    }

    using (ShareGroups.UserGroup userGroupService = new ShareGroups.UserGroup())
    {
        userGroupService.Url = siteUrl + @"/_vti_bin/UserGroup.asmx";
        userGroupService.Credentials = new NetworkCredential(
            userDetails.UserName,
            Decrypt(userDetails.Password, "asdasdasdsad" + userDetails.MacAddress));

        permissions = userGroupService.GetRolesAndPermissionsForCurrentUser();
        userInfo = userGroupService.GetUserInfo(userDetails.ResolvedUserName);
    }
}