Please enable JavaScript to view this site.

Altova FlowForce Server 2020 

This example shows you how to create a job which validates an XML file against a schema. If the job fails due to any reason, the error details will be written to a log file. For validation, we will use the valxml-withxsd function of RaptorXML Server. (The RaptorXML Server functions become available in FlowForce Server when RaptorXML Server is licensed.) Note that, for the error logging part, the technique illustrated in this example is not dependent on RaptorXML Server and can be applied to other job types.

 

In this particular example, the job will be defined as a Web service, so that you can trigger it on demand, by accessing a URL from the browser. However, if necessary, you can also add to the job a timer (or file system) trigger, similar to how this is done in other examples. You could even add to the same job a combination of a trigger and a Web service. This way, the job will run not only as defined by the trigger rules, but also on demand, when the Web service is called.

 

Prerequisites

Required licenses: FlowForce Server, RaptorXML (or RaptorXML+XBRL) Server

FlowForce Server is running at the configured network address and port (see Setting the Network Address and Port)

Your FlowForce Server user account has permissions to one of the containers (by default, the /public container used in this example is accessible to any authenticated user).

The job created in this example generates a log file every time when it runs. Therefore, on the operating system where FlowForce Server runs, you must have rights to create files in some directory (this example uses the C:\FlowForce directory).

 

Demo files used

The XML file validated in this example is available in the RaptorXML Server installation folder, at the following path: C:\Program Files\Altova\RaptorXMLServer2020\examples\NanonullOrg.xml. On a 64-bit Windows running 32-bit FlowForce Server, the path would be C:\Program Files (x86)\Altova\RaptorXMLServer2020\examples\NanonullOrg.xml, unless you installed RaptorXML Server in a different folder.

 

Creating the job

1.Log on to FlowForce Server and navigate to a container where you have permission to create new jobs (in this example, we are using /public).

2.Click Create, and then select Create job.

3.Add a Job name (ValidateFile, in this example) and, optionally, a job description.

ex-raptor-01-01

4.Under "Execution Steps", click the add button, and then select new error/success handling step.

ex-raptor-01-02

5.Under "Execute with error/success handling", click the add button, and choose to add a new execution step, with the following settings:

 

Execute function

Set the value to /RaptorXML/valxml-withxsd. You can also find this function in any container that corresponds to a specific RaptorXML release, for example /RaptorXML/2020/valxml-withxsd.

Parameters

Set the value of the XML File parameter to:

 

C:\Program Files (x86)\Altova\RaptorXMLServer2020\examples\NanonullOrg.xml

 

fs_valxml_job

6.Under the "On error" condition, click the add button and choose to add a new execution step, with the following settings:

 

Execute function

/system/compute

Parameters

Set the value of Expression to:

 

as-file(stdout(failed-step()))

 

Assign this step's result to

Enter a value which will uniquely identify the result of this job (for example, MyResult ). By doing this, you are declaring this value as a variable, so that you can use it in a subsequent step.

ex-raptor-01-04

7.Under the previous execution step, click the add button and choose to add a new execution step, with the following settings:

 

Execute function

/system/filesystem/copy

Parameters

Next to the Source parameter, click ff-setTo and select the MyResult variable declared earlier.

 

Next to the Target parameter, type the path where the log will be saved (in this example, the path is C:\FlowForce\ValidateFile.log). Note that the C:\FlowForce directory must exist on the server where FlowForce Server runs, and you must have permission to write to it.

 

Next to the Overwrite parameter, select the check box. The log file is generated each time the job runs, so this ensures that the job does not fail when the log file already exists.

ex-raptor-01-05

8.Under Service, click to select the Make this job available via HTTP check box, and enter ValidateFile as name of the service.

9.Under "Credentials", select an existing credential record or specify a local credential (see Credentials ).

10.Click Save.

 

To test the job, enter http://127.0.0.1:4646/service/ValidateFile in the browser's address bar, provided that FlowForce Server runs at the default host and port name. If you have defined other host and port settings in the Configuration page (see Setting the Network Address and Port ), change the address accordingly. If prompted for credentials when accessing the Web service, supply the same credentials you use to log on to FlowForce Server.

 

If the job executes successfully (that is, if it returns the exit code "0"), the browser displays the standard output of the job, for example:

 

file:///C:/Program%20Files%20(x86)/Altova/RaptorXMLServer/examples/NanonullOrg.xml: runtime="16ms" result="OK"

 

If the job returns an exit code other than "0" (for example, due to an incorrect path, validation errors, and so on), the browser displays a "Service execution failed" message and the output is written to the C:\FlowForce\ValidateLog.log file. In the event that the log file was not generated, check the log of the job in FlowForce Server to identify the error (see Viewing the Job Log). It may be the case, for example, that the /system/filesystem/copy function has failed because you have no permission to write to the target path, in which case the log file cannot be generated.

© 2019 Altova GmbH