Running Mappings and Transformations as Jobs
You can create a FlowForce Server job from a MapForce mapping or StyleVision transformation as follows:
1.First, deploy the mapping or transformation to FlowForce Server. This step is done in MapForce (and StyleVision, respectively):
•On the File menu, click Deploy to FlowForce (Server).
For reference to the deployment settings, see Deploying Mappings to FlowForce Server.
2.In FlowForce Server, navigate to the FlowForce container where you deployed the mapping or transformation (for example, the container "/public").
3.Click the required mapping or transformation, and then click Create Job. Alternatively, you can refer to the mapping or transformation from an existing job, by entering its path in the Execute function box:
You can now configure the job according to your needs. For example, you can run it as a Web service, or with the help of a trigger. For a step-by-step example which illustrates deploying a StyleVision transformation and creating a job from it, see Creating a Job from a StyleVision Transformation. For a similar example for MapForce, see Creating a Job from a MapForce Mapping. For an example job which calls both MapForce Server and StyleVision Server, see Example: Generating Multiple PDFs from Multiple XMLs.
One of the most important parts of running a transformation or mapping job is handling the job input files. There are two approaches you can take: supply the input files statically to the job, or supply them dynamically at job runtime (for example, from a path). The exact approach to use depends on your needs. If your job needs to run with the same input data every time, then the first approach is suitable. Otherwise, if you need your FlowForce jobs to pick up data from files supplied dynamically from a path, then the second approach must be used.
In case of mappings deployed from MapForce, any instance files (such as XML, CSV, JSON, Excel, and so on) are deployed together with the mapping and implicitly packaged as static. This means that, when the job runs, FlowForce will read data from the statically packaged files by default, which might not always be what you need. There are two scenarios here:
1.If you right-click the mapping in MapForce and select the Make paths absolute in generated code check box before deploying the mapping, all the input files explicitly appear with the prefix altova://packagefile/ in FlowForce Server.
To instruct FlowForce Server not to read data from packaged files, remove the prefix altova://packagedfile from the path. You can then refer to the file using either an absolute or a relative path. If using a relative path, the path is relative to the Working Directory parameter. For example, if you intend to provide as input some files from C:\FlowForce\CompletePO, then set the working directory to C:\FlowForce\CompletePO and enter just the name of the input files, as shown below.
2.If the Make paths absolute in generated code check box is NOT selected before deploying the mapping to FlowForce, the input files are shown with their relative path in FlowForce. Note that FlowForce will still read data from the packaged file in this case as well, even when there are files with the same name in the working directory. To instruct FlowForce not to read data from the packaged file, you can either make the file paths absolute or supply them as parameters to the job, as shown below:
Alternatively, you can change the mapping design in MapForce so that the input file names are input parameters to the mapping. For example, the mapping illustrated below takes both the input and output file names as parameters.
When deployed to FlowForce Server, the parameters appear as such in the job configuration page (the files themselves are not packaged).
The mapping illustrated above is called FileNamesAsParameters.mfd and is one of the example files that ship with MapForce. For information about how this mapping is designed, refer to the MapForce documentation.
In case of StyleVision transformations, you can handle input files as follows:
1.Open the PXF (Portable XML Form) file in StyleVision. If you have a SPS (StyleVision Power Stylesheet), StyleVision will prompt you to convert it to PXF format when you attempt to deploy it to FlowForce Server.
2.In the Design Overview window, click Configure embedded files. A dialog box appears.
3.Notice the option Embed the working XML file. If you select this check box, the working XML file will be part of the deployed package and, by default, FlowForce Server will read data from it each time when the job runs. A packaged file is indicated as such in FlowForce:
To supply the file dynamically to the job, remove the prefix altova://packagedfile/ or change the path to an absolute one. If using a relative path, the path is relative to the Working Directory parameter. Alternatively, clear the Embed the working XML file check box before deploying the transformation to FlowForce Server.
If you clear the Embed... check box for resources like CSS files or images, FlowForce Server will look for them in the job working directory.