Geeks With Blogs
Fringe SharePoint Continued
          I am currently on a project that consists of an integration between a web application and SharePoint. Both applications live in their own servers and so it was necessary to use web services. I have come to many weird glitches and many unresolved issues at this time, I will make an effort to document as much as possible to save people time when working with WCF, SharePoint Web Services, and Visual Studio 2008.0

The first issue I'm going to write about is fairly easy to identify but it was frustrating dealing with.

The code that I wrote looked something like this:

        _service.UpdateList(listID, GetDocLibNameChange(newListName),null, null, null, listVersion);

The _service is the ListSoapClient that I have access to through WCF. I simply update the name of the document library to something else. I feel I should post the code for the update XmlElement, there is detailed information and documentation on updating just about everything about a document library. This scenario was real simple, I only needed the ability to change the document library name. This is the code for the GetDocLibNameChange() method that puts together that XmlElement:

private XmlElement GetDocLibNameChange(string newName)
        {
            var xmlDoc = new XmlDocument();
            var elBatch = xmlDoc.CreateElement("List");
            elBatch.SetAttribute("Title", newName);
            return elBatch;
        }


That's it! Almost, I was getting a weird outcome where when I executed the UpdateList web service method I was getting an exception. Of course the exeption was a generic SOAP Exception, which I could not make tails of, and really couldn't because there was not much more than just Soap Exception.  It turns out that the Update was still occuring!! So, update worked but exception was coming back!

 SOLUTION:
    If you read MSND page on this method, it specifies that the ListID is really a string of the list guid: "{GUID}". It turns out I got careless and was just passing in the list name. Note to self, pass in the expected paramaters!!! I felt like bloggint this to show 2 things:
    1) The update still occured even with the excpetion.
    2) How useless the soap exception messages and stack trace really are!

 Happy Coding!

Juan Posted on Wednesday, August 19, 2009 5:17 PM SharePoint | Back to top


Comments on this post: Unexpected WCF web Service Behaviour

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © juanlarios | Powered by: GeeksWithBlogs.net