2 Replies Latest reply on Aug 25, 2010 1:55 PM by DicaBr

    Using Sharepoint Lists webservice

      Got a project dumped on my plate that seemed pretty darned simple to start with. Find a way to use the Sharepoint Webservices to update and display data from Sharepoint Lists. Well, that doesn't seem to bad. It's a webservice, it uses soap, just have to connect to it and then pass information back and forth.

      Turns out that it wasn't that simple. Basically we're attempting to utilize the Lists.asmx sharepoint service. I have no problem with the methods that take only simple type parameters (strings, integers, etc). But the majority of the methods take one or more "XmlNode" types. These things are in the WSDL as
      <s:element minOccurs="0" maxOccurs="1" name="updates">
      <s:complexType mixed="true">
      <s:any />

      So the million dollar question is what the heck do I put in my <cfinvokeargument> to pass that thing. Reading up on the web I find that it shoudl be wanting an XML fragment that looks something like this:
      <Batch OnError = "Return" ListVersion="1" ViewName="">
      <Method ID="1" Cmd="New">
      <Field Name="ID">New</Field>
      <Field Name="Title">My Test</Field>

      Again, seemed easy enough I used <cfxml> and created a fragment. Then I put the variable into my <cfinvokeargument> and blithly expected it to work. Instead I got an error "java.lang.IllegalArgumentException: argument type mismatch". More reading and I realized that I shoudl probably be just passing it as a string. So I just put the XML right into my <cfinvokeargument>. Got a new error:
      Web service operation UpdateListItems with parameters {listName={{EF36FF97-F57C-4D98-9087-0630EE337B98}},updates={NewMy Test}} cannot be found.

      So now with a string in there it can't find the stub. I've gotten variations on the messages but pretty much it all boils down to the same... it can't seem to access the webservice using those darned complex types. If anyone has any input on this I'd love to hear it. I tried drilling down to see what the underlying types are and turns out that at the end of the day it's an array of MessageElement. But I don't know how to instantiate that either so it didn't really seem to help.