Showing results for 
Search instead for 
Do you mean 
Reply
New Member
Posts: 2
Registered: ‎04-10-2014

Start workflow with XML / web service

Hi,

 

Is it possible to start a workflow using a XML file instead of CSV?

 

Also does Core have a webservice for posting XML to start a workflow?

 

Thanks

FreeFlow User
Posts: 74
Registered: ‎01-09-2014

Re: Start workflow with XML / web service

Hi,

 

I hope this example will help.

In this case the XML has three jobs, each made of a PDF file. In addition to the file, number of copies for each job is set in the Copies tag. So the incoming XML looks like:

 

<?xml version="1.0" encoding="ISO-8859-1"?>
<Jobs>
  <Job>
    <File>C:\temp\test1.pdf</File>
    <Copies>100</Copies>
  </Job>
  <Job>
    <File>C:\temp\test2.pdf</File>
    <Copies>50</Copies>
  </Job>
  <Job>
    <File>C:\temp\test3.pdf</File>
    <Copies>200</Copies>
  </Job>
</Jobs>

 

To get this to work, first you need to create a XSL file mapping the values to columns. The xsl will create a CSV file out of the xml. The XSL would look like:

 

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="Jobs">
<xsl:for-each select="Job">
<xsl:text>&#10;</xsl:text>
<xsl:value-of select="File"/>
<xsl:text>,</xsl:text>
<xsl:value-of select="Copies"/>
<xsl:text>,</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

 

This XSL, is looking in the parent tag Jobs, for tags called Job. Each Job tag, gets it's own line in the CSV (&#10). Then in the line the value from the Field tag is placed, after which a comma is placed. After this the number of copies is placed, and again another comma.
Save this XSL file to a folder e.g. "C:\Xerox\FreeFlow\Core\Data\XSL\st_test.xsl"

 

The second item required to do the conversion is the script. This is placed in the FreeFlow Core installation directory and called TransformXML.bat.
Setup your Scripting settings in the Connection setup as shown in the screenshot attached.

Note, use the full path to the TransformXML.bat and also note that you have to give the name of the output csv in the parameters as "$FFout$\out.csv"

 

The third part is in the MAX configuration, setup the File Name to be column A and Quantity to be column B.

 

If you now place the xml into the hot folder, the first thing that happens, you get a stdout.log file added to a MAX Status folder. It should look something like:
<stdout 21/08/2017 09:55:31>
</stdout>


At this time you get a file out.csv saved into ScriptOutput folder. At this point the MAX picks up the out.csv and processes it.
You will get the final MAX Status inside ScriptOutput\Max Status and it should be called out.status.csv and in this case three jobs should appear in Job Manager (in case you have the files test1.pdf-test3.pdf in your temp folder).

 

Jyri