Hi, how would I duplicate a Part in a message. Example:
I have the following part at Index 0:
<user>
<first></first>
</last></last>
<id></id>
<code></code>
</user>
and I need to create a second part based off the first part like this:
<other>
<id></id>
<code></code>
</other>
but keeping the original part at Index 0.
Any ideas?
Thanks!
Wesley
Hi Wesley,
Are you using Sonic 8.0? If yes, then you can use the new message mapping feature. You select part at index 0 on the left and use a transformation action and set the target for the mapping to a new part. Depending on where you want this message you can use either request or response mapping. Refer to the documentation for details on enabling message mapping.
If you are on an older version you could consider:
- Dropping in to javascript with a transformation service or cbr service step
- Use the message extension in XSL with the transformation service step
- Code this in a service
- All of these options will work in 8.0 as well.
Thanks
-Mahesh
Hi Mahesh,
Thanks for the quick response.
Im a little confused about what you said, as the only processes that have the Message Mapping feature are:
Could you explain your method a little more? And yes, Im using 8.0.
Thanks!
Wes
Hello Wesley,
I can't answer for the message mapping feature but I have already done this using XmlTransfo Service.
first you create a js file :
function rule()
{
prt = XQMessage.getPart(0);
prt.setContentId("PartName");
XQMessage.addPart(prt);
resultArray = new java.util.ArrayList();
resultArray.add("sonicfs:///workspace/YourProject/transfo.xsl"); //Transform the part using this stylesheet
resultArray.add(new java.lang.Integer(1)); //operate the part 1
return resultArray;
}
Then create the transfo.xsl to transform the orignal message into your target message.
Add the js and xsl files to a XmlTransfo step of your process.
Regards
Chan Jeremy
Hi Wes,
For details on enabling message mapping for a service type, look for the 'Enabling message mapping for a service type' section in chapter 5 of "Sonic Workbench: ESB Developer's Guide" at:
http://documentation.progress.com/output/Sonic/8.0.1/Docs8.0/online_help/esb_dev.pdf
Thanks
-Mahesh