The scenario here is that we have an Async JMS service and the original publisher is a legacy application. This pubishes it’s message in an XML-format. Which is cool, however there are no XSD’s available and the message contains no namespaces.


With the help of a professional tool (Liquid XML Studio) we are able to generate an XSD from large numbers of the XMLs we received from the legacy application. Next step is creating a decent service contract (WSDL/XSD). When finished the primary subscriber of our async. service receives the WSDL/XSD datamodel from us which it imports.

However our subscriber requires a exposed namespace in the message it receives. (we tried using configuring hidden/local namespace qualification in the XSD but these fail during import). So the message would need to look something more like this:

<e08:EDI xmlns:e08="">

We want to use Oracle Service Bus as passive intermediate as much as possible. So we use a simple Rename Action of the Oracle Service Bus.

This does the trick because all elements ( //* ) in variable body are now renamed to the new namespace we require.

update May 9th: not adding namespace, but removing them

If you need to do it the other way around, like removing the namespaces from an XML message. I haven’t been able to find a way to this with the Rename Action of the Oracle Service Bus. However there is a simple XSLT stylesheet you can use. (this code is not mine but found it on the web once upon a lifetime in a galaxy far far far away. I’ve been using it for some time, but sadly don’t know who to give credits)

<xsl:stylesheet version=”1.0″ xmlns:xsl=””&gt;
<xsl:output method=”xml” indent=”no”/>

<xsl:template match=”/|comment()|processing-instruction()”>

<xsl:template match=”*”>
<xsl:element name=”{local-name()}”>
<xsl:apply-templates select=”@*|node()”/>

<xsl:template match=”@*”>
<xsl:attribute name=”{local-name()}”>
<xsl:value-of select=”.”/>

Use a replace action on the message $body and your namespaces will disappear like ninjas in the night. 😉