I am pretty new in WSO2 ESB and I have the following problem trying to retrieve the value of a property and put into an XML document that I am generating.
So, I have the following situation, in my ESB flow I have defined this property named TRANSACTION and having register as value:
<property name="TRANSACTION" scope="default" type="STRING" value="register"/>
Then in my flow I am generating an XML document (it works fine), using a payloadFactory mediator, in this way:
<payloadFactory media-type="xml">
<format>
<register password="$14" username="$13" xmlns="http://ws.wso2.org/dataservice">
<location>
<wiews>$1</wiews>
<pid>$2</pid>
<name>$3</name>
<address>$4</address>
<country>$5</country>
<lat>$6</lat>
<lon>$7</lon>
</location>
<sampledoi>$8</sampledoi>
<sampleid>$9</sampleid>
<date>$10</date>
<method>$11</method>
<genus>$12</genus>
</register>
</format>
<args>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:hold_wiews/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:hold_pid/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:hold_name/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:hold_address/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:hold_country/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:hold_lat/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:hold_lon/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:sample_doi/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:sample_id/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:date/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:method/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:genus/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:username/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:password/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
</args>
</payloadFactory>
That genetes an XML document like this:
<?xml version="1.0" encoding="UTF-8" ?>
<register username="myUserName" password="myPswd">
<sampleid>CGN00001</sampleid>
<genus>Hordeum2</genus>
...................................
...................................
...................................
I want use the value of my TRANSACTION property to create the name of the first tag of my XML document, in this:
<register password="$14" username="$13" xmlns="http://ws.wso2.org
the register name have to be a $15 variable that use the TRANSACTION property value. I think that I can define it in some way into the ... list but I don't know how. At this time in this list I only have value retrieved from a DSS service output, in this case I think that I have to put the value of my TRANSACTION property, but how?
So, is it possible to something like this:
<$15 password="$14" username="$13" xmlns="http://ws.wso2.org
to dinamically insert the tag name?