Author |
Message
|
Gemz |
Posted: Tue Feb 26, 2013 2:38 am Post subject: Namespace Wildcard in Route Node |
|
|
 Centurion
Joined: 14 Jan 2008 Posts: 124
|
Hi,
I am using a ROUTE NODE in a flow and I would like to know the wildcard character to be defined in the filter table.
I will get different namespace for different kind of request. Based on a channel value at below sample XPath I need to route the message.
Code: |
Xpath - $Body/p:Purchase/p:Header/p:ChannelId='Online' |
If I define the namespace value for p with exact value(eg: http://test.com/purchase) it matches the filter.
If I define the namespace value for p as '*' it is not matching the filter. _________________ GemZ
"An expert is one who knows more and more about less and less until he knows absolutely everything about nothing...." |
|
Back to top |
|
 |
McueMart |
Posted: Tue Feb 26, 2013 3:07 am Post subject: |
|
|
 Chevalier
Joined: 29 Nov 2011 Posts: 490 Location: UK...somewhere
|
Have you tried putting the wildcard in the XPath expression itself?
i.e.
Code: |
$Body/*:Purchase/*:Header/*:ChannelId='Online' |
Does that work? |
|
Back to top |
|
 |
Gemz |
Posted: Tue Feb 26, 2013 3:13 am Post subject: |
|
|
 Centurion
Joined: 14 Jan 2008 Posts: 124
|
McueMart wrote: |
Have you tried putting the wildcard in the XPath expression itself?
i.e.
Code: |
$Body/*:Purchase/*:Header/*:ChannelId='Online' |
Does that work? |
Yes, I tried it. It did not work and I think it didn't even compile as I got some error while deploying the flow.
i.e., If we define the Namespace value as '*' then it gets deploy without error, but does not matched the filter.
If we specify '*' in XPath expression, we get below deployment error.
Code: |
BIP6229E: Generic expression: It was not possible to parse an ESQL expression, in node 'Route_Service_Id'. An incorrect ESQL expression was supplied. An ESQL path element was expected. |
_________________ GemZ
"An expert is one who knows more and more about less and less until he knows absolutely everything about nothing...." |
|
Back to top |
|
 |
kimbert |
Posted: Tue Feb 26, 2013 4:30 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I think your path is a mixture of XPath expression syntax and ESQL path reference syntax. Try removing the leading '$'.
Alternatively, use XPath but define ( and use in your XPath expression ) namespace prefixes for all namespaces referenced in the path. |
|
Back to top |
|
 |
Gemz |
Posted: Tue Feb 26, 2013 5:21 am Post subject: |
|
|
 Centurion
Joined: 14 Jan 2008 Posts: 124
|
From Infocenter
Quote: |
The XPath Expression Builder helps you to construct message processing expressions in either XPath or ESQL. You are free to enter expressions by hand, or use the XPath Expression Builder to help construct such expressions. |
If I have ESQL expression as below it works fine without Namespace:
Code: |
Body.Purchase.Header.ChannelId='Online' |
If I have ESQL expression with namespace, I get Error while deploying the bar file:
Code: |
Body.*:Purchase.*:Header.*:ChannelId='Online' |
Code: |
The message broker received a configuration message containing the attribute value 'boolean(Body.*:Purchase.*:Header.*:ChannelId='Online')', which is not valid for the target attribute ' filterPattern in row: [3] of filter table', on object ' RouteNode'. Valid values are ' XPath 1.0 only expressions'. This can be caused by a mismatch in levels between the Message Broker Toolkit and the broker. Or it can be caused as a result of a node defined by a user, or written by a third party, where the implementation library installed at the broker does not match the node definition held at the Message Broker Toolkit. |
In Error Message it says 'Valid values are ' XPath 1.0 only expressions'.' Does Xpath1.0 supports namespace?
As I am not able to upgrade Broker or Toolkit for this mismatch, I have to try it with XPath expression.
I am trying to specify XPath expression with Wildcard Namespace in Route Node. _________________ GemZ
"An expert is one who knows more and more about less and less until he knows absolutely everything about nothing...." |
|
Back to top |
|
 |
kimbert |
Posted: Tue Feb 26, 2013 5:51 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
The message broker received a configuration message containing the attribute value 'boolean(Body.Purchase.Header.ChannelId='Online')' |
I think this may be the problem. It looks as if the path that you have entered is being used as the argument to the XPath boolean() constructor. So that argument will need to be a valid XPath expression.
Quote: |
I am trying to specify XPath expression with Wildcard Namespace in Route Node. |
XPath 1.0 does not allow this type of namespace wildcard. You need to either
a) specify the namespace(s) and the prefix(es) that you want to use. The XPath builder should provide a way to specify these. Then use your chosen prefix(es) in the XPath expression.
or
b) Use this strange-looking trick to implement a namespace wildcard using XPath 1.0 :
Code: |
Body.*[local-name(.) = 'Purchase'].*[local-name(.) = 'Header'].*[local-name(.) = 'ChannelId'] |
I would strongly recommend a). |
|
Back to top |
|
 |
Gemz |
Posted: Tue Feb 26, 2013 6:50 am Post subject: |
|
|
 Centurion
Joined: 14 Jan 2008 Posts: 124
|
kimbert wrote: |
a) specify the namespace(s) and the prefix(es) that you want to use. The XPath builder should provide a way to specify these. Then use your chosen prefix(es) in the XPath expression.
or
b) Use this strange-looking trick to implement a namespace wildcard using XPath 1.0 :
Code: |
Body.*[local-name(.) = 'Purchase'].*[local-name(.) = 'Header'].*[local-name(.) = 'ChannelId'] |
I would strongly recommend a). |
Yes, We can specify the namaspaces prefixes in Namespace setting in XPath Builder Expression.
As I required wildcard namespace, I opt to option (b).
Thanks Kimbert.
Code: |
$Body/*[local-name(.) = 'Purchase']/*[local-name(.) = 'Header']/*[local-name(.) = 'ChannelId'] |
_________________ GemZ
"An expert is one who knows more and more about less and less until he knows absolutely everything about nothing...." |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Feb 26, 2013 9:01 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Quote: |
If I have ESQL expression as below it works fine without Namespace:
Code: |
Body.Purchase.Header.ChannelId='Online'
If I have ESQL expression with namespace, I get Error while deploying the bar file:
Body.*:Purchase.*:Header.*:ChannelId='Online' |
|
Obviously in the second expression you are not building the path but just assigning a value.
I would have thought in changing this into 2 statements:
Code: |
DECLARE xref REFERENCE TO Body:*:Purchase.*:Header.*:ChannelId;
IF LASTMOVE(xref) THEN
SET xref = 'Online';
END IF;
|
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|