JBoss Community

Re: Check if header element exists in message Response.

created by Tom Fennelly in JBoss ESB Development - View the full discussion

Hi Carlos... I got your private message... here's the answer...

 

Sounds like you have 2 issues... handling a large/huge message and conditionally adding a header element.

 

Handle the huge message by setting th filter type to SAX (default is DOM => can't handle big messages)  See User Guide.

 

For conditionally adding the header... in the versions of Smooks in the ESB (easier in newer versions of Smooks)... easiest way is prob to do something like the following...

 

<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.2.xsd">

 

    <jb:bean beanId="headerDetails" class="java.util.HashMap" createOnElement="order/header">

       <jb:value property="secureId" data="order/header/secureId" />

    <jb:bean>

 

    <ftl:freemarker applyOnElement="order/header">

        <condition>isdef headerDetails.secureId</condition>

        <ftl:template><!-- <secureId>blah</secureId> --></ftl:template>

        <ftl:use>

            <ftl:inline directive="addto" />

        </ftl:use>

    </ftl:freemarker>

 

</smooks-resource-list>

 

So.. capture details about the data in the header into a HasMap and then add a conditional on a template (having an "addto" directive) that's applied to the header fragment.

Reply to this message by going to Community

Start a new discussion in JBoss ESB Development at Community