Conversion of SonicMQ Text Message to XML Message in Sonic E

Posted by Admin on 10-Dec-2009 00:24

Hi,

   I am sending some text message using Sonic MQ Queue/Topic as entry point to the ESB Process. I want to know, how can I wrap the text message part( Body Part), So that It form a XML message. The example in Sonic ESB tutorials (File Pickup service — *.pickup ) shows to Wrap the File content to XML message . I want to know the configuration document for getting the String Message from Queue/Topic and Wrap the message in XML like  <wrapInXML>true</wrapInXML> .

Below is the setting for Filepickup Request and convert the content to XML. I want the same setting for Text message of Sonic MQ Queue/Topic .

<?xml version="1.0" encoding="UTF-8"?>

<

filePickupRequest>

<

recordSplitting>

<

recordsPerMessage>1</recordsPerMessage>

<

sendHeader includeInMessages="true">false</sendHeader>

<

sendTrailer>false</sendTrailer>

<

wrapInXML>true</wrapInXML>

</

recordSplitting>

<

components>

<

filePickup>

<

defaultFilePickup>

<!-- The maximum number of files to pickup in one cycle -->

<

maxFilesToPickup>3</maxFilesToPickup>

<!-- The local directory in which to look for the files -->

<

pickupDirectory>C:\Sonic\ESB7.6\samples\Sample.ESB/File Handling/Binary File Transfer/pickup</pickupDirectory>

<!-- A regex pattern to apply for filenames to search in the

pickup directory. This example: All Files ending in ".pdf" (lowercase) -->

<!-- filenamePattern>.*\.pdf</filenamePattern> -->

<

filenamePattern>.*\.txt</filenamePattern>

<!-- The amount of time to wait for a matching file before a timeout occurs -->

<

timeoutSeconds>60</timeoutSeconds>

<!-- The maximum file size, 10MB recommended. -->

<

maxFileSizeKb>10240</maxFileSizeKb>

<!-- The content type: text, binary, or xml

This example uses binary to ensure the file is consumed "as is"

with no character set encoding. -->

<

contentType>text</contentType>

<!-- The cleanup action: delete, rename, move and none

This example uses "move" to move the file to the specified directory once it has been consumed -->

<

cleanupAction action="move">

<

moveToDirectory>C:\Sonic\ESB7.6\samples\Sample.ESB/File Handling/Binary File Transfer/moveTo</moveToDirectory>

</

cleanupAction>

</

defaultFilePickup>

</

filePickup>

<

splitter id="LINE_COUNT_SPLITTER">

<

lineCountSplitterComponent>

<

headerLineCount>0</headerLineCount>

<

recordLineCount>1</recordLineCount>

<

trailerLineCount>0</trailerLineCount>

</

lineCountSplitterComponent>

</

splitter>

</

components>

</

filePickupRequest>

Thanks

Ramesh

All Replies

Posted by p.feunteun on 11-Dec-2009 04:49

Hi Ramesh,

We had the same issue, and we applied the two following solutions :

  • Add a transform service with a xsl stylesheet in order to convert the message from txt to XML
  • Create a custom service (But it was also for other needs).

Attached to this comment, you will find an example of XSL file we have used for that.

I hope this will help you

Best Regards

This thread is closed