Rami Neji
Rami Neji

Reputation: 3

Error when calling ValidateWorkflowMarkupAndCreateSupportObjects

I created a workflow in sharepoint designer then i exported xoml, xoml.rules, xoml.wfconfig.xml files from it.

I want to deploy these files in sharepoint using a host application (Windows Forms application). So, I call ValidateWorkflowMarkupAndCreateSupportObjects and AssociateWorkflowMarkup method from the WebPartPagesWebService class. Here's the code:

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 return "Data at the root level is invalid. Line 1, position 1".

And AssociateWorkflowMarkup throws Microsoft.SharePoint.SoapServer.SoapServerException.

The Logs file:

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.

Upvotes: 0

Views: 1029

Answers (1)

Ondrej Tucny
Ondrej Tucny

Reputation: 27962

You pass in file names, but the method requires the actual XML. (Ask yourself: you are calling a web service, so typically remotely, then how could the server read any files from your local PC's drive?) Read the MSDN documentation; however, note that the 2013 version is not very clear about it and you have to look at the 2007 version of the docs.

Upvotes: 2

Related Questions