hi, i've been using the SPServices.GetTemplatesForItem method in my development environment no problem via
var itemURL = documentURL;var testVar; $().SPServices({ operation: "GetTemplatesForItem", item: itemURL, async: false, completefunc: function (xData, Status) { $(xData.responseXML).find("WorkflowTemplates > WorkflowTemplate").each(function (i, e) { testVar = $(xData.responseXML);// hard coded workflow nameif ($(this).attr("Name") == wfName) {var guid = $(this).find("WorkflowTemplateIdSet").attr("TemplateId");if (guid != null) { workflowGUID = "{"+ guid + "}"; } } }); } });return workflowGUID;
this works fine in the test/dev environment (i'm using SPSerivces-0.7.1.a.js) however i have found that this query will not work in production. I have actually stepped through the jquery.SPServices-0.7.1a.js code and have found that the soap messages generated for the call at line 1094, $.ajax({ (in sp services) are nearly identical:
not working SOAP Message:
"<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'><soap:Body>
<GetTemplatesForItem xmlns='http://schemas.microsoft.com/sharepoint/soap/workflow/' >
<item>http://trac-sp01/demo/demotown/InformationManagement/Governance/testabc.docx</item>
</GetTemplatesForItem></soap:Body></soap:Envelope>"
working SOAP Message:"<soap:Envelope xmlns:xsi=\'http://www.w3.org/2001/XMLSchema-instance\' xmlns:xsd=\'http://www.w3.org/2001/XMLSchema\' xmlns:soap=\'http://schemas.xmlsoap.org/soap/envelope/\'><soap:Body>
<GetTemplatesForItem xmlns=\'http://schemas.microsoft.com/sharepoint/soap/workflow/\' >
<item>http://sptest/sites/rmtm3/expiryTest/TLOGO.jpg</item>
</GetTemplatesForItem></soap:Body>
</soap:Envelope>"
i have checked all of my urls and they should be fine!.. THe thing i did notice is that the workingexample I notice that in my dev/test enviornment soap message has single quotes (') prepended by an escape character while in production this is not the case. Does anyone know why this escape character prepending is not happening, and is this the reason why my query is failing? I have been struggling on trying to get this to work all day and i'm pulling hairs!