Reuse BPEL XSLT maps in OSB

Reusing XSLT maps from existing BPEL processes in OSB is quite easy. There is however, a small change required in the namespace of the maps. At a minimal a BPEL process generally involves transformation from a Source namespace to a Target namespace for the invoking and response variables between the Client BPEL process and the Target Process. An OSB Proxy is ordinarily based on a Target WSDL itself and hence there is no change of namespace from the Source to the Target.

Then how do we re-use the BPEL XSLTs in OSB then? The trick is to include a small change in the namespace. In the imported XSLTs change the namespaces of the Source Process’s namespaces to that of the Target Process’s namespace.

Just to elucidate, imagine a hypothetical Mid BPEL process that sits between a Requestor and a Provider. This BPEL process does the following transformations at the minimum:

1.   Transform from Mid BPEL process input to that of the Provider input. (SetInput.xsl)

<xsl:stylesheet version=”1.0″
xmlns:client=”http://xmlns.oracle.com/migrationCompositeTest_jws/TransformCompatibilityTest/MidBPELProcess&#8221;
xmlns:ns0=”http://xmlns.oracle.com/migrationCompositeTest_jws/TransformCompatibilityTestProvider/TransformCompatibilityTestBPELProvider&#8221;
exclude-result-prefixes=”client ns0″>
<xsl:template match=”/”>
<ns0:element2>
<xsl:value-of select=”/client:process/client:element2″/>
</ns0:element2>
</ns0:process>
</xsl:template>
</xsl:stylesheet>

2.   Transform from Provider output to that of the Mid BPEL process output. (SetOutput.xsl)

<xsl:stylesheet version=”1.0″  xmlns:client=”http://xmlns.oracle.com/migrationCompositeTest_jws/TransformCompatibilityTestProvider/TransformCompatibilityTestBPELProvider&#8221;
xmlns:ns0=”http://xmlns.oracle.com/migrationCompositeTest_jws/TransformCompatibilityTest/MidBPELProcess&#8221;
exclude-result-prefixes=”client ns0″>
<xsl:template match=”/”>
<ns0:processResponse>
<ns0:element2>
<xsl:value-of select=”/client:processResponse/client:element2″/>
</ns0:element2>
</ns0:processResponse>
</xsl:template>
</xsl:stylesheet>

So, when reusing in OSB, do the following:

1.   In SetInput.xsl, change the namespace of the Source Namespace to that of the Target.

<xsl:stylesheet version=”1.0″
xmlns:client=”http://xmlns.oracle.com/migrationCompositeTest_jws/TransformCompatibilityTestProvider/TransformCompatibilityTestBPELProvider&#8221;
xmlns:ns0=”http://xmlns.oracle.com/migrationCompositeTest_jws/TransformCompatibilityTestProvider/TransformCompatibilityTestBPELProvider&#8221;
exclude-result-prefixes=”client ns0″>
<xsl:template match=”/”>
<ns0:element2>
<xsl:value-of select=”/client:process/client:element2″/>
</ns0:element2>
</ns0:process>
</xsl:template>
</xsl:stylesheet>

2.   In SetOutput.xsl, change the namespace of the Target Namespace that of the Source Namespace.

<xsl:stylesheet version=”1.0″                xmlns:client=”http://xmlns.oracle.com/migrationCompositeTest_jws/TransformCompatibilityTestProvider/TransformCompatibilityTestBPELProvider”       xmlns:ns0=”http://xmlns.oracle.com/migrationCompositeTest_jws/TransformCompatibilityTestProvider/TransformCompatibilityTestBPELProvider&#8221;
exclude-result-prefixes=”client ns0″>
<xsl:template match=”/”>
<ns0:processResponse>
<ns0:element2>
<xsl:value-of select=”/client:processResponse/client:element2″/>
</ns0:element2>
</ns0:processResponse>
</xsl:template>
</xsl:stylesheet>

Note: The maps have been simplified.

That’s about it! Maps can now be resued in OSB.

A pdf version of this tutorial is right here…

<xsl:stylesheet version=”1.0″
xmlns:client=”http://xmlns.oracle.com/migrationCompositeTest_jws/TransformCompatibilityTestProvider/TransformCompatibilityTestBPELProvider&#8221;
xmlns:ns0=”http://xmlns.oracle.com/migrationCompositeTest_jws/TransformCompatibilityTestProvider/TransformCompatibilityTestBPELProvider&#8221;
exclude-result-prefixes=”client ns0″>
<xsl:template match=”/”>
<ns0:element2>
<xsl:value-of select=”/client:process/client:element2″/>
</ns0:element2>
</ns0:process>
</xsl:template>
</xsl:stylesheet>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: