A Web Service to transform Excel files into XML files

Version 1 by Vincent Zurczak
on Apr 03, 2010 11:51.

compared with
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (17)

View Page History
Here is what the job looks like.

!BackupLogs_2.jpg!

\\
In the scope of possible extensions, the Petals end-point will be generated by Petals on deployment. Thus, to deploy a new instance of this job inside Petals, there is no need to edit the or reexport the job. You can use the same deployment archive and install it directly.

Also, export the context va
Also, export the context variable _inLocation_ as an *In-Attachment*.
And export the context variable _outLocation_ as a *Parameter and Out-Attachment*.


h1. Configuration for the Petals-SE-Quartz component

Exposing the Talend job as a service inside Petals allows it to be called by any client.
This features allows the use of the Petals-SE-Quartz component.
Every 3 days, this component will be in charge of sending a message to trigger the execution of the BackupLogs job.

\\
The job will be called every three days, let's say at noon. It corresponds to the following CRON expression.
h1. Configuration for the Petals-BC-SOAP component

{noformat}
0 0 12 1/3 * ?
{noformat}
The creation of a SOAP configuration is generally fairly simple using the Petals Studio.
The goal here is to create a configuration for the Petals SOAP component, that will consume the Talend service.
It means every call this configuration will handle will be forwarded to the consumed service.

\\ {info}
And the XML message to send can be found, as an example, with SoapUI.
In this case, no parameter is required.
Please, make sure to use at least the version 4.0.3 of the Petals-BC-SOAP.
Previous versions did not manage MTOM attachments (in input and in output) correctly.
{info}

Here is the jbi.xml for the configuration.

{code:lang=xml}
<tal:executeJob>
{code}

\\
The configuration below was generated with the Petals Studio for the version 1.1 of the Petals-SE-Quartz component.

{code:lang=xml}
<?xml version="1.0" encoding="UTF-8"?>
<!--
JBI descriptor for the Petals' "petals-se-quartz" component (Quartz).
Originally created for the version 1.1 of the component.
-->
<jbi:jbi version="1.0"
xmlns:generatedNs="http://petals.ow2.org/components/ftp/version-3"
xmlns:jbi="http://java.sun.com/xml/ns/jbi"
xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5"
xmlns:quartz="http://petals.ow2.org/components/quartz/version-1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<!-- Import a Service into Petals or Expose a Petals Service => use a BC. -->
<jbi:services binding-component="false">

<!-- Expose a Petals Service => consumes a Service. -->
<jbi:consumes
interface-name="itfNs:BackupLogsServicePortType"
service-name="srvNs:BackupLogsService"
endpoint-name="BackupLogsEndpoint"
xmlns:srvNs="http://petals.ow2.org/talend/"
xmlns:itfNs="http://petals.ow2.org/talend/">

<!-- CDK specific elements -->
<petalsCDK:timeout>30000</petalsCDK:timeout>
<petalsCDK:mep>InOnly</petalsCDK:mep>

<!-- Component specific elements -->
<quartz:cron-expression>0 0 12 1/3 * ?</quartz:cron-expression>
<quartz:content><![CDATA[<tal:executeJob>
<tal:contexts/>
<tal:in-attachments/>
</tal:executeJob>]]></quartz:content>
</jbi:consumes>
</jbi:services>
</jbi:jbi>
{code}


h1. Running the use case

To test this use case, the first valuable thing to do would be to change the CRON expression, so that the jobs is executed every minute instead of every day.
{noformat}0 1 * * * *{noformat} should work.

\\
Then, add a log file in the directory the *tFileList* will list.
As an example, you can use the following log sample. It will be inserted in the database (let the job create the table).

{noformat}
07-07-2007 07:45:53 error CATALO An error occured while taking a command.
03-06-2009 16:42:50 info USERS New user registered.
11-04-2009 06:39:51 error 8E1gMN W4mcL2CIpTLl0cOHumMvIJ8gaF9m0cUWFAyyRBGv3
11-04-2007 07:23:48 warning gaINXp mrEyySARH6Yc3tMWFzlFO2bYUpchwekQI43xD83G4
05-05-2009 13:00:47 info CxoGez N5vkw9F4jczRRfj807ZXEyvi86pAhkASAsb5b2a95
01-03-2009 19:33:30 info aM8JZo lKDMq5GF4syj2NTlSkfAA4kMtR5ASXzLaCNlJDrg6
23-06-2009 20:11:07 warning 3mIzm1 yIKmz0xUYW4058hUe2v0dq8to4JAutbG3ONAohVL7
29-05-2009 10:23:11 info wfyrV2 1erGxKQyDSNffb2wFII43OA1L6rMsdeV28mZKZVK8
17-02-2008 09:41:24 info AsZFLL 45eJQpAYKhxGLiA6KYhgRsfM5Ltu4gbIgFBxyh2P9
09-04-2008 01:52:37 warning UllFc9 J8x1CMJbkSYgx0KBLlMNFtqAPixPVYA4VgYZagqP10
14-12-2008 18:17:25 error GUpq0U CNw6lbzMLcZ5ixugAM7Zmna8AclbXAS6JKvVZ6us11
08-01-2008 05:26:04 info qde3jr O41PMrbdetJfFaYKXkGA4EufaTyjFjl1L6KUFb3H12
24-08-2008 01:57:30 error Guuyun GOdUV6h2uQT6BBiIkXBNweQ37xKqiycxzN3cNJz013
15-02-2009 01:35:17 warning RcK0An 3XfRFHZVxmPWyWYYxwUPEIdS0UfVA4Lohv8mH4sf14
10-10-2009 01:37:54 info gKDXsQ sGp7W1lHIcEMmRVplXubIEhiuPyvqeM0uitH8kFu15
27-12-2007 20:24:55 info HpcAdh rEb8afMwiEATnoiDSjNxeY5flbG2o30AIasBOJCR16
26-09-2008 18:02:58 warning mHulRI G0FiOoaHh54ip5V5SyYacQiKgyckCN0Z1CEdw5Yo17
{noformat}

\\
Deploy the *Petals-SE-Quartz* and *Petals-SE-Talend* components in Petals, as well as the two service-units.
Wait for a minute and check the Petals console and the database.
The console should display information about the request processing in the *Petals-SE-Talend* component.
The database should see the logs table created and filled-in. And the log file should have been moved into the _backup_ directory.
To test this use case, you need to deploy the Petals-SE-Talend and Petals-BC-SOAP components in Petals.
Then, deploy the configurations for these two components.
Eventually, create a Java client, e.g. using Apache CXF or Axis 2. There are several such examples in the simple use cases.
{column}
{column:width=350px}