I'm implementing a content based router in camel using XPath. But for some reason the XPath expression doesn't evaluate the content and always the otherwise path is chosen. This is the route I defined in my camel-context:
<route>
<from uri="cxf:bean:hioServiceEndPoint"/>
<process ref="hioProcessor"/>
<inOnly uri="file:{{path.ws.data}}/incoming/hio?fileName=hio_${date:now:yyyyMMdd_HHmmssSS}.xml"/>
<choice>
<when>
<xpath>//ORDER_TYPE = 'CROSSDOCKING'</xpath>
<log message="NIELS Incoming CROSS HIO !!!"/>
<to uri="jms:incomingHioCross"/>
</when>
<otherwise>
<to uri="jms:incomingHio"/>
<log message="NIELS Incoming HIO"/>
</otherwise>
</choice>
<transform>
<constant>OK</constant>
</transform>
</route>
And this is the XML which needs to be searched for the tag ORDER_TYPE
:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<INBOUND_ORDER xmlns="urn:ifsworld-com:schemas:handle_inbound_order">
<DELIVERY_LEADTIME>0.0</DELIVERY_LEADTIME>
<DELNOTE_DATE>2010-12-15T00:00:00</DELNOTE_DATE>
<DELNOTE_NO>1454</DELNOTE_NO>
<DESPATCH_DATE>2010-12-15T16:39:43</DESPATCH_DATE>
<ORDER_DATE>2010-12-15T16:39:43</ORDER_DATE>
<ORDER_NO>1454</ORDER_NO>
<ORDER_TYPE>CROSSDOCKING</ORDER_TYPE>
<REMARKS xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<SITE>DC2</SITE>
<VENDOR_NO>ALM</VENDOR_NO>
<INBOUND_ORDER_LINES>
<INBOUND_ORDER_LINE>
<CURRENCY_CODE>EUR</CURRENCY_CODE>
<PART_NO>1276.1</PART_NO>
<QUANTITY>2.0</QUANTITY>
<QUANTITY_UNIT_MEAS>PCS</QUANTITY_UNIT_MEAS>
<REMARKS xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<SEQUENCE_NO>1.0</SEQUENCE_NO>
<UNIT_PRICE>0.0</UNIT_PRICE>
</INBOUND_ORDER_LINE>
</INBOUND_ORDER_LINES>
</INBOUND_ORDER>
I can't see what I'm doing wrong, I also tried /INBOUND_ORDER/ORDER_TYPE = 'CROSSDOCKING'
but even then I can seem to get It working. I wrote a test case to see if my XPath expression is correct and that works fine and returns true.
I'm using camel 2.5.0.
So if anybody has a tip, I would appreciate it.