2

I need to use some configuration settings to transform message with Smooks mediator. For example I want to inject a base URL into attribute value of outgoing xml during transformation.

In Java I'd do it by adding beans to ExecutionContext. Looking at SmooksMediator code I do not see this. Can I do it somehow or I should extend and recompile SmooksMediator to supply properties form MessageContext?

Community
  • 1
  • 1
adnecs
  • 175
  • 1
  • 10

2 Answers2

3

For the input as the Smooks mediator we can feed only one stream from the ESB. So if you want to transform a message by injecting a property, you can't achieve it with the smooks mediator.

Use XSLT mediator for this [1]. When configuring the XSLT mediator you can define properties to be passed into the transformation.

ex:

 <xslt key="orderTransformer">
   <property expression="get-property('name')" name="name"/>
   <property expression="get-property('email')" name="email"/>
</xslt>

Then inside the XSLT you can define the two properties as below,

<xsl:param name="email"/>
<xsl:param name="name"/>

and use them appropraitely as $email and $name in templates.

<ns1:email>
        <xsl:value-of select="$email"/>
    </ns1:email>
    <ns1:name>
        <xsl:value-of select="$name"/>
    </ns1:name>

[1] http://docs.wso2.org/wiki/display/ESB460/XSLT+Mediator

BenMorel
  • 34,448
  • 50
  • 182
  • 322
0

The whole configuration details of Smooks mediator can be found from [1].

Else you can go for a custom mediator to perform your exact task. Detail on custom mediator can be found from [2].

[1]. http://wso2.org/library/tutorials/2011/06/perform-data-mapping-smooks-editor-wso2-carbon-studio

[2]. http://maninda.blogspot.com/2012/11/writing-custom-mediator-for-wso2-esb.html

Thank you, Dharshana

Chandana
  • 2,578
  • 8
  • 38
  • 55
Dharshana
  • 1,212
  • 1
  • 9
  • 18