RestfulWebServiceWF
The RestfulWebServiceSample REST web service input device retrieves JSON jobs from RICOH ProcessDirector web services that simulate a web site for ordering books. The input device sends the jobs to the RestfulWebServiceWF workflow.
When a JSON job enters the Parent branch of the workflow, the SetJobPropsFromTextFile step sets values for the Customer name and Custom 1 properties.
The ConvertJSONToXML step converts the job into XML.
The ApplyXSLTransform step uses the orderToOverrides.xslt
XSLT style sheet to convert 2 XML elements into 2 RICOH ProcessDirector job properties in an overrides file. The step puts the overrides file in the spool
directory for the job. RICOH ProcessDirector uses
the values in the overrides file to set the values of the properties for the job.
XML element | Job property |
---|---|
orderId | Job.Info.Attr3 |
customername | Job.CustomerName |
The AssignJobValues step sets the value of the Job name property.
The CallRESTService step makes a GET call to one of the sample web services that simulate the web site for ordering books. The web service returns JSON job ticket information for the order to RICOH ProcessDirector.
The ConvertJSONToXML step converts the JSON job ticket information into XML.
The CreateJobsFromXML step uses the //JobTicket XPath expression to parse the XML job ticket information. The step finds 2 job tickets and creates 2 child jobs. The step submits the 2 child jobs to the RestfulWebServiceWF workflow.
The rule on the [2] Child connector determines whether the jobs are child jobs by checking for a decimal point in the job number. The connector sends child jobs through the Child branch of the workflow.
The original JSON job continues through the Parent branch to the RunHotFolderApplication step. That step puts the JSON job in a hot folder.
One of the sample web services polls the hot folder for jobs. The web service processes each JSON job when it receives a request from the RestfulWebServiceSampleNotify notification.
The ApplyXSLTransform2 step uses the jobticketToOverrides.xslt
XSLT style sheet to convert 6 XML elements for each child job into RICOH ProcessDirector job properties in an overrides file:
XML element | Job property |
---|---|
file | Job.Info.Attr2 |
itemnumber | Job.Info.Attr1 |
type | Job.Info.Attr4 |
title | Job.Info.Attr5 |
copies | Job.Copies |
media | Job.Media |
The DownloadFile step downloads the Brochure.pdf
and Cover.pdf
files.
The AssignJobValues2 step sets the values of 3 job properties, including Requested printer.
The OptimizePDF, CountPages, CreatePageRanges, and PrintJobs steps process and print the child jobs.
When each child print job arrives at the RetainCompletedJobs step, the RestfulWebServiceSampleNotify web service notification makes a POST call to one of the sample web services. The web service waits until all the child jobs for the original JSON job are in the Retained job state. The web service then creates a PDF file containing the job number and item number of each job ticket in the order, for example:
10000001.2 with item number 278955095 has been processed10000001.1 with item number 913895452 has been processed
The web service puts the PDF file in the retrieval hot folder for the RunHotFolderApplication step.
The RunHotFolderApplication step polls the hot folder, finds the PDF file, and sends the job to the next step.
The AssignJobValues step sets the value of the Input data stream property to PDF and sends the PDF job to the RetainCompletedJobs step.
You can select the PDF job in the jobs table and view it to confirm that the 2 child jobs have been processed.
For an example that includes sample data, see the related task for running the RestfulWebServiceWF workflow.