How to launch a request with a FILE using SOAP Web Services

Configure the process

To send a file to a process, perform the following steps:

  1. Enable Sub-process mode for the process and set Access level to Public.




  2. Create a file data (such as REQUEST_FILE) and select IN or INOUT for Sub-process parameter.

    Create%20file%20data

Create a request with a file as parameter

With the WorkflowGen Web Service SOAP, you have to use the StartProcess method.

Use file path

The file you want to upload has to be accessible by WorkflowGen; it could be in a network folder.

Use XML context

<NewDataSet>
    <parameter>
        <name>REQUEST_FILE</name>
        <dataType>FILE</dataType>
        <direction>OUT</direction>
        <fileName>report.xls</fileName>
        <fileDescription>My report</fileDescription>
        <fileSize>202345</fileSize>
        <fileContentType>application/vnd.ms-excel</fileContentType>      
        <fileDateLastModified>2017-02-17T02:07:43Z</fileDateLastModified>
        <fileOriginalPath>C:\myfolder\report.xls</fileOriginalPath>
        <filePath>C:\myfolder\report.xls</filePath>
    </parameter>
</NewDataSet>

In this example the file needs to be in C:\myfolder\ on the WorkflowGen server. If the file is not present, you will receive a File not found error.

not%20found

You can try this context with the following URL: http://[YOUR_SITE]/wfgen/ws/processesruntime.asmx?op=StartProcess

startprocess

Build the context with WorkflowGen.My

To simplify WorkflowContext creation and modification, you can use WorkflowGen.My and its WorkflowGen.My.Data.ContextParameters class.

To send a file you can use the FileInfo class.

WorkflowGen.My.Data.ContextParameters myWorkflowContextParameters = new WorkflowGen.My.Data.ContextParameters();

ContextFileReference cfr = new ContextFileReference();
FileInfo fi = new FileInfo(@"C:\myfolder\report.xls");
cfr.Name = fi.Name;
cfr.Description = fi.Name;
cfr.Path = fi.FullName;
cfr.OriginalPath = fi.FullName;
cfr.ContentType = "application/vnd.ms-excel";
cfr.DateLastModified = fi.LastWriteTimeUtc;
cfr.Size = fi.Length;

WorkflowGen.My.Data.ContextParameter contextParam = new WorkflowGen.My.Data.ContextParameter();

contextParam.Name = "REQUEST_FILE";

contextParam.Direction = WorkflowGen.My.Data.ContextParameter.Directions.Out;

contextParam.Type = typeof(string);

contextParam.Value = cfr;

myWorkflowContextParameters.Add(contextParam);

myWorkflowContextParameters.Update();

string workflowContext = myWorkflowContextParameters.GetXml();