Petals-SE-XSLT 2.3

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

Changes (55)

View Page History
The resulting XML document is then returned in the response, either as the payload, or as an attachment.

\\
This component only acts as service provider, not as a service consumer.
In fact, it provides a transformation service.

Additional information about XSLT can be found at [http://www.w3.org/TR/xslt].

{column}

h1. Recommended usage

\\
{tip}
The XSLT component should be used when chaining calls to services whose output and input do not match.
It can also be used to expose XSL transformations as a service, provided that the content to transform is passed in the message payload, and not as attachment.
{tip}


h2. Understand the problematic
h2. Taking an example

Let's suppose you want to know where lives a person.
You have two services that can help you in this task.
Let's take the example of two "white pages" services.
These services aims at helping in finding where a person lives (or how to contact this person).

\\


h1. XSLT configurations and WSDL interfaces
h1. Creating a XSL Transformation service (Provides modes)

Configurations (service-units) for the XSLT component do not have, in general, a WSDL interface.
However, it is possible to define one. This WSDL must define two operations, being *transform* and *transformToAttachment*.
These two operations are the ones the component supports. The associated name space (WSDL operation names are QNames) depends on the version of the component.
For the versions 2.3 of the XSLT component, this name space is [http://petals.ow2.org/components/xslt/version-2]
Each XSLT service runs on the Petals XSLT component.
The Petals XSLT component has native operations to invoke. These operations are inherited by the XSLT services.
A XSLT service cannot add additional operations. It only has the ones of the XSLT component.

\\
When calling *transform*, the transformed message is returned as the message payload.
When calling *transformToAttachment*, the transformed message is attached to the response.
In this second case, the payload is
The version 2.3 of the Petals XSLT component exposes two operations.
* *transform*: the received message is transformed with the XSL style sheet. The transformation result is returned as the response payload.
* *transformToAttachment*: the received message is transformed with the XSL style sheet. The transformation result is attached to the response.

{code:lang=xml}
<attached-files>
<file-name>myOutputAttachmentName</file-name>
<attached-files>
{code}

h2. The "transform" operation

The fully qualified name of this operation is:
* Name space URI: *{html}http://petals.ow2.org/components/xslt/version-2{html}*
* Local part: *transform*

\\
The input and output messages for these operations are related to the XSL style sheet.
In fact, the input message should be the output message of the previous service (the one whose output must be transformed).
This operation only supports the *InOut* message exhange pattern (MEP).
When invoking this operation, you must call it using its fully qualified name.
It must also be the operation name in the WSDL of any XSLT service.

\\
And the output message depends on the operation.
For the *transform* operation, it should be the input message of the next service to be called.
For the other operation, it is almost the same every time, since it is an attachment.
Obviously, each time it is written _service_, it means *service operation*. Because you cannot chain calls to services, but only chain calls to service operations.
Here is the execution flow for this operation:
# The received message is transformed with the XSL style sheet.
# The transformation result is returned as the response payload.

{warning} \\
The XSLT component supports only the *InOut* message exchange pattern.
{warning}
The result of the transformation depends on the XSL style sheet.


h2. The "transformToAttachment" operation

The fully qualified name of this operation is:
* Name space URI: *http://petals.ow2.org/components/xslt/version-2*
* Local part: *transformToAttachment*

\\
As said at the beginning of this section, WSDL are not mandatory though.
Typically, integration use cases do not require one. But not having one is bad practice in SOA. Your XSLT service is then not reusable, and no one else will ever use it unless you give him the XSL style sheet to determine the expected input and output.
This operation only supports the *InOut* message exhange pattern (MEP).
When invoking this operation, you must call it using its fully qualified name.
This operation cannot be described in a WSDL, because of the result it returns.

\\
Thus, beginning by creating a WSDL, and then continuing by the XSL style sheet appears as the best practice to have.
Here is the execution flow for this operation:
# The received message is transformed with the XSL style sheet.
# The transformation result is attached to the response.

\\
The attachment is not sent in MTOM mode.
The result of the transformation has always the same shape.

h1. Component configuration
{code:lang=xml}
<attached-files>
<file-name>myOutputAttachmentName</file-name>
<attached-files>
{code}

The component can be configured through its JBI descriptor file, as shown below.
{code:lang=xml}<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<jbi
version="1.0"
xmlns='http://java.sun.com/xml/ns/jbi'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5">
... where _myOutputAttachmentName_ is the name of the attachment.
This operation will most likely be depreciated in future versions.

<component type="service-engine">
<identification>
<name>petals-se-xslt</name>
<description>A Xslt Service Engine</description>
</identification>

<component-class-name description="Xslt Component class">org.ow2.petals.se.xslt.XsltComponent</component-class-name>
<component-class-path><path-element/></component-class-path>
<bootstrap-class-name>org.ow2.petals.component.framework.DefaultBootstrap</bootstrap-class-name>
<bootstrap-class-path><path-element/></bootstrap-class-path>
h2. WSDL definitions

<petalsCDK:acceptor-pool-size>3</petalsCDK:acceptor-pool-size>
<petalsCDK:processor-pool-size>10</petalsCDK:processor-pool-size>
<petalsCDK:ignored-status>DONE_AND_ERROR_IGNORED</petalsCDK:ignored-status>
<petalsCDK:notifications>false</petalsCDK:notifications>
<petalsCDK:jbi-listener-class-name>org.ow2.petals.se.xslt.listener.JBIListener</petalsCDK:jbi-listener-class-name>
</component>
</jbi>{code}
Configurations (service-units) for the XSLT component do not have, in general, a WSDL definition.
However, it is possible to define one. This WSDL can only describe the *transform* operation.
The *transformToAttachment* operation cannot be described in a WSDL. This last operation is rather intended for integration use cases.
This is also why this operation will probably be marked as depreciated in the next version.


\\
The component configuration includes the configuration of the CDK. The following parameters correspond to the CDK configuration.
{include:0 CDK Component Configuration Table}
The input and output messages for the *transform* operation are related to the XSL style sheet.
In fact, the input message should be the output message of the previous chained service (the one whose output must be transformed).
And the output message should be the input message of the next chained service.

\\
This component does not have any specific configuration parameter.
As said at the beginning of this section, WSDL are not mandatory though. Typically, integration use cases do not require one. But not having one is bad practice in SOA.
Your XSLT service is then not reusable, and no one else will ever use it unless you give him the XSL style sheet to determine the expected input and output.

\\
{warning} {tip}
The Petals-SE-XSLT component can only handle messages coming from inside the bus. Therefore, you cannot specify an external-listener class-name.
Beginning by creating a WSDL, and then continuing by the XSL style sheet appears as the best practice to have.
{warning} {tip}


h1. Service Configuration
h2. JBI descriptor

h2. Service Unit descriptor

The Service -Unit descriptor file ( jbi.xml ) looks like this:
{code:lang=xml}<?xml version="1.0" encoding="UTF-8"?>
<!--

\\
*Configuration of a Service -Unit to expose an XSLT-transformation service into Petals ESB:*

|| Parameter || Description || Default || Required ||


h2. Service Unit content
h2. Service-Unit content

The service unit must contain the XSL style sheet.
+ customFunctions.jar (optional)
{noformat}


h1. Configuring the component

The component can be configured through its JBI descriptor file, as shown below.
{code:lang=xml}<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<jbi
version="1.0"
xmlns='http://java.sun.com/xml/ns/jbi'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5">

<component type="service-engine">
<identification>
<name>petals-se-xslt</name>
<description>A Xslt Service Engine</description>
</identification>

<component-class-name description="Xslt Component class">org.ow2.petals.se.xslt.XsltComponent</component-class-name>
<component-class-path><path-element/></component-class-path>
<bootstrap-class-name>org.ow2.petals.component.framework.DefaultBootstrap</bootstrap-class-name>
<bootstrap-class-path><path-element/></bootstrap-class-path>

<petalsCDK:acceptor-pool-size>3</petalsCDK:acceptor-pool-size>
<petalsCDK:processor-pool-size>10</petalsCDK:processor-pool-size>
<petalsCDK:ignored-status>DONE_AND_ERROR_IGNORED</petalsCDK:ignored-status>
<petalsCDK:notifications>false</petalsCDK:notifications>
<petalsCDK:jbi-listener-class-name>org.ow2.petals.se.xslt.listener.JBIListener</petalsCDK:jbi-listener-class-name>
</component>
</jbi>{code}


\\
The component configuration includes the configuration of the CDK. The following parameters correspond to the CDK configuration.
{include:0 CDK Component Configuration Table}

\\
This component does not have any specific configuration parameter.