Thanks Claus.

I am able to parse and use the first element named ${headers.SevtType} in
velocity, excellent!

Yet the second element named ${headers.SItemID} is not populated. Here are
the current file:

Camel context:
-------------------
<camelContext xmlns="http://camel.apache.org/schema/spring";
xmlns:evt="http://namespaces.softwareag.com/EDA/Event";
        
xmlns:pay="http://namespaces.softwareag.com/EDA/WebM/Sample/InventoryMgmt/1.0";>
<route id="Route_Emit_InvShortage">
        <setHeader headerName="evtType">
                <xpath>/evt:Event/evt:Header/evt:Type</xpath>
        </setHeader>
        <choice>
                <when>
                        <xpath>$evtType =                       
'{http://namespaces.softwareag.com/EDA/WebM/Sample/InventoryMgmt/1.0}PartInventoryShortage'
                                        </xpath>
                        
                        <setHeader headerName="SevtType">
                                <xpath
resultType="java.lang.String">/evt:Event/evt:Header/evt:Type</xpath>
                        </setHeader>
                        <setHeader headerName="SItemID">
                                <xpath
resultType="java.lang.String">/evt:Event/evt:Body/pay:PartInventoryLow/pay:Part/pay:ItemID</xpath>
                        </setHeader>
                        <to uri="velocity:file:src/main/resources/email.vm" />

Velocity:
-------------------
Dear Purchaser,

We have an urgent situation. We need ${body.DesiredInventoryLevel} piece(s)
for item number ${headers.SItemID}, yet suppliers only have
${body.SupplierInventoryLevel} piece(s). 

Please review this situation.

This is an automated email, triggered by event '${headers.SevtType}'. Please
do not reply.


Questions:
-------------------
<1> Why is the setHeader for ItemID not working?
<2> What would the xpath command be to retrieve the local element, not the
entire URI?
Current:
'{http://namespaces.softwareag.com/EDA/WebM/Sample/InventoryMgmt/1.0}PartInventoryShortage'
Desired: 'PartInventoryShortage'
<3> If I have the XSD, can I parse the entire document and reference all
elements in velocity and not require the <setHeader> commands for each
element?
<4> In velocity, when do I use body.<element> versus header.<element> ?


--
View this message in context: 
http://camel.465427.n5.nabble.com/Velocity-without-java-tp5042885p5052886.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to