Workflow web service error

Jun 10, 2010 at 10:46 PM

I'm trying to call the Workflow web service operations--GetWorkflowDataForItem, GetToDosForItem, GetTemplatesForItem, and GetWorkflowTaskData--on list items, and I'm receiving the following error in the SOAP response:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.</faultstring>
<detail><errorstring xmlns="http://schemas.microsoft.com/sharepoint/soap/">Value does not fall within the expected range.</errorstring></detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>

I am passing the URL of the list item on which I want Workflow data, which has the format http(s)://server/site/Lists/ListName/DispForm.aspx?ID=5 (I've also tried http(s)://server/site/Lists/ListName?ID=5, and several other variations).  In this case, it's the Announcements list, but I've tried with other custom lists with the same result.  I have successfully called the workflow service operations on items in a Document Library, which have the format http(s)://server/site/DocLib/document.doc, and I've only ever seen Document Library item URLs used in the Workflow web service documentation, blogs, examples, and such.

So my question is: can the Workflow Web Services be called for custom list items, or does the service only work for document library items?  If it can work for a custom list, how would I format the URL input parameter?  Any help with this would be very much appreciated.

Coordinator
Jun 14, 2010 at 4:56 AM

Bobby:

Sorry for the delayed response. Could you post the calls you are trying to make so that I can try to reproduce the issue in my environment?  To be honest, I haven't done much with the Workflow Web Service since I added it to SPServices, but I'd be happy to take a look.

M.

Jun 14, 2010 at 2:19 PM

Hi Marc,

I broke rule #1 of help forums, and didn't post my code!  Sorry about that.  Here are the calls (sanitized) that result in the error response above:

$().SPServices({      
  operation: "GetWorkflowDataForItem",
  webURL: "https://domain/site",
  item: "https://domain/site/Announcements?ID=5",
  completefunc: function(xdata, status) {
    workflowData.text(xdata.responseText);
  }
});

where 'workflowData' is the jQuery object wrapping the DOM element into which I'm inserting the text.  The above call yields the error I posted above.  The following call, however, successfully returns workflow data:

$().SPServices({      
  operation: "GetWorkflowDataForItem",
  webURL: "https://domain/site",
  item: "https://domain/site/page.html",
  completefunc: function(xdata, status) {
    workflowData1.text(xdata.responseText);
  }
});

 Any help you could give me would be very much appreciated!

Coordinator
Jun 14, 2010 at 2:42 PM

Bobby:

Have you tried this syntax for the item URL

https://domain/site/Announcements/5_.000

where 5 is the item's ID?

M.

Jun 14, 2010 at 3:09 PM

Marc:

I had tried that format during my thrashings, as that is the format returned by GetListItems, with the same result.  However, encouraged by your above post, I tried several different iterations of that format, and found one that worked:

https://domain/site%20name/Lists/Announcements/5_.000

The problem I had in previous attempts using this format was that I used the literal string copied from the response from GetListItems, which included unencoded spaces in the URL.  When I replaced the spaces with '%20', the call succeeded.

Thank you very much, Marc, for your helpful response and for your great jQuery library!

Regards,

Bobby

Coordinator
Jun 14, 2010 at 3:12 PM

Awesome. Glad you got it working. Gotta love the SDK for stuff like this. Clear as mud would be a complement.

M.