调用ValidateWorkflowMarkupAndCreateSupportObjects时出错

时间:2014-02-25 07:23:36

标签: sharepoint sharepoint-workflow

我在sharepoint designer中创建了一个工作流,然后我从中导出了xoml,xoml.rules,xoml.wfconfig.xml文件。

我想使用主机应用程序(Windows窗体应用程序)在sharepoint中部署这些文件。因此,我从ValidateWorkflowMarkupAndCreateSupportObjects类调用了AssociateWorkflowMarkupWebPartPagesWebService方法。 这是代码:

string XomlFile = @"D:\wkf\rami workflow designer.xoml";
string RulesFile = @"D:\wkf\rami workflow designer.xoml.rules";
string ConfigFile = @"D:\wkf\rami workflow designer.xoml.wfconfig.xml";
string flag = "2";

websvcWebPartPages.WebPartPagesWebService service = new websvcWebPartPages.WebPartPagesWebService();
service.UseDefaultCredentials = true;
service.PreAuthenticate = true;
string result = service.ValidateWorkflowMarkupAndCreateSupportObjects(XomlFile, RulesFile, ConfigFile, flag);
service.AssociateWorkflowMarkup(ConfigFile, "V1.0");

ValidateWorkflowMarkupAndCreateSupportObjects返回“Data at the root level is invalid. Line 1, position 1”。

AssociateWorkflowMarkup抛出Microsoft.SharePoint.SoapServer.SoapServerException

日志文件:

Unknown SPRequest error occurred. More information: 0x80070002    3dccdc9b-af66-4f72-b41f-51a4d1774b35

SOAP exception: System.IO.FileNotFoundException: The system cannot find the file specified. (Exception of HRESULT : 0x80070002)   
at Microsoft.SharePoint.Library.SPRequestInternalClass.GetFileAndFolderProperties(String bstrUrl, String bstrStartUrl, ListDocsFlags ListDocsFlags, Boolean bThrowException, Int32& phrStatus, Object& pvarFiles, Object& pvarDirs, UInt32& pdwNumberOfFiles, UInt32& pdwNumberOfDirs)  
at Microsoft.SharePoint.Library.SPRequest.GetFileAndFolderProperties(String bstrUrl, String bstrStartUrl, ListDocsFlags ListDocsFlags, Boolean bThrowException, Int32& phrStatus, Object& pvarFiles, Object& pvarDirs, UInt32& pdwNumberOfFiles, UInt32& pdwNumberOfDirs)
at Microsoft.SharePoint.SPWeb.GetFileOrFolderProperties(String strUrl, ListDocsFlags listDocsFlags, Boolean throwException, ...    3dccdc9b-af66-4f72-b41f-51a4d1774b35 ...SPBasePermissions& permMask)
at Microsoft.SharePoint.SPFile.PropertiesCore(Boolean throwException)
at Microsoft.SharePoint.Workflow.SPWorkflowNoCodeSupport.LoadWorkflowBytesElevated(SPFile file, Int32 fileVer, Int32& userid, DateTime& lastModified)
at Microsoft.SharePoint.Workflow.SPWorkflowNoCodeSupport.LoadWorkflowBytes(SPFile file, Int32 fileVer, Int32& userid)
at Microsoft.SharePoint.SoapServer.WebPartPagesWebService.AssociateWorkflowMarkup(String configUrl, String configVersion)    3dccdc9b-af66-4f72-b41f-51a4d1774b35.

1 个答案:

答案 0 :(得分:2)

传入文件名,但该方法需要实际XML 。 (问问自己:你是在调用Web服务,所以通常是远程服务,那么服务器如何从本地PC的驱动器中读取任何文件?)阅读MSDN文档;但请注意,2013 version对此并不十分清楚,您必须查看2007 version of the docs