ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » esql not able to access xml element

Post new topic  Reply to topic
 esql not able to access xml element « View previous topic :: View next topic » 
Author Message
jfecq
PostPosted: Mon Sep 24, 2012 1:33 am    Post subject: esql not able to access xml element Reply with quote

Apprentice

Joined: 24 Sep 2012
Posts: 36

Hi, I have the following design where different xml schemas messages are sending to the same queue. A message flow processes these messages and by determining an element in the xml and route to a corresponding destination.

Firstly, each message definition has its own namespace otherwise broker will complain A Message Set can not contain two global element declarations with the same name and namespace (target or chameleon)??

Example of the schema and xml message is as below.

Code:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://mytest/wor"
xmlns="http://mytest/wor" elementFormDefault="qualified">
 <xs:annotation>
  <xs:documentation xml:lang="en">
   Purchase order schema for Example.com.
   Copyright 2000 Example.com. All rights reserved.
  </xs:documentation>
 </xs:annotation>

 <xs:element name="wor" type="worType"/>

 <xs:complexType name="worType">
  <xs:sequence>
   <xs:element name="interface_id" type="xs:string"/>
   <xs:element name="aa" type="xs:string"/>
   <xs:element name="bb" type="xs:string"/>
  </xs:sequence>
 </xs:complexType>

</xs:schema>


Code:
<?xml version="1.0" encoding="UTF-8"?><wor xmlns="http://mytest/wor"><interface_id>wor</interface_id><aa>aa</aa><bb>bb</bb></wor>


I tried to use the following esql to access interface_id but no luck. A trace node ${Root} after MQInput shows

Code:
( ['MQROOT' : 0x257ecbf0]
  (0x01000000:Name  ):Properties = ( ['MQPROPERTYPARSER' : 0x25b4f2a0]
    (0x03000000:NameValue):MessageSet             = 'MyTestLibraryMessageSet' (CHARACTER)
    (0x03000000:NameValue):MessageType            = '' (CHARACTER)
    (0x03000000:NameValue):MessageFormat          = '' (CHARACTER)
    (0x03000000:NameValue):Encoding               = 546 (INTEGER)
    (0x03000000:NameValue):CodedCharSetId         = 1208 (INTEGER)
    (0x03000000:NameValue):Transactional          = TRUE (BOOLEAN)
    (0x03000000:NameValue):Persistence            = FALSE (BOOLEAN)
    (0x03000000:NameValue):CreationTime           = GMTTIMESTAMP '2012-09-24 09:27:39.700' (GMTTIMESTAMP)
    (0x03000000:NameValue):ExpirationTime         = -1 (INTEGER)
    (0x03000000:NameValue):Priority               = 0 (INTEGER)
    (0x03000000:NameValue):ReplyIdentifier        = X'000000000000000000000000000000000000000000000000' (BLOB)
    (0x03000000:NameValue):ReplyProtocol          = 'MQ' (CHARACTER)
    (0x03000000:NameValue):Topic                  = NULL
    (0x03000000:NameValue):ContentType            = '' (CHARACTER)
    (0x03000000:NameValue):IdentitySourceType     = '' (CHARACTER)
    (0x03000000:NameValue):IdentitySourceToken    = '' (CHARACTER)
    (0x03000000:NameValue):IdentitySourcePassword = '' (CHARACTER)
    (0x03000000:NameValue):IdentitySourceIssuedBy = '' (CHARACTER)
    (0x03000000:NameValue):IdentityMappedType     = '' (CHARACTER)
    (0x03000000:NameValue):IdentityMappedToken    = '' (CHARACTER)
    (0x03000000:NameValue):IdentityMappedPassword = '' (CHARACTER)
    (0x03000000:NameValue):IdentityMappedIssuedBy = '' (CHARACTER)
  )
  (0x01000000:Name  ):MQMD       = ( ['MQHMD' : 0x25ed2bd0]
    (0x03000000:NameValue):SourceQueue      = 'mq.queue' (CHARACTER)
    (0x03000000:NameValue):Transactional    = TRUE (BOOLEAN)
    (0x03000000:NameValue):Encoding         = 546 (INTEGER)
    (0x03000000:NameValue):CodedCharSetId   = 1208 (INTEGER)
    (0x03000000:NameValue):Format           = 'MQSTR   ' (CHARACTER)
    (0x03000000:NameValue):Version          = 2 (INTEGER)
    (0x03000000:NameValue):Report           = 0 (INTEGER)
    (0x03000000:NameValue):MsgType          = 8 (INTEGER)
    (0x03000000:NameValue):Expiry           = -1 (INTEGER)
    (0x03000000:NameValue):Feedback         = 0 (INTEGER)
    (0x03000000:NameValue):Priority         = 0 (INTEGER)
    (0x03000000:NameValue):Persistence      = 0 (INTEGER)
    (0x03000000:NameValue):MsgId            = X'414d51206d71716d67722020202020207937605020071c02' (BLOB)
    (0x03000000:NameValue):CorrelId         = X'000000000000000000000000000000000000000000000000' (BLOB)
    (0x03000000:NameValue):BackoutCount     = 0 (INTEGER)
    (0x03000000:NameValue):ReplyToQ         = '                                                ' (CHARACTER)
    (0x03000000:NameValue):ReplyToQMgr      = 'mqqmgr                                          ' (CHARACTER)
    (0x03000000:NameValue):UserIdentifier   = 'mquser      ' (CHARACTER)
    (0x03000000:NameValue):AccountingToken  = X'1601051500000027488490bdc8a78788f5a0e2e803000000000000000000000b' (BLOB)
    (0x03000000:NameValue):ApplIdentityData = '                                ' (CHARACTER)
    (0x03000000:NameValue):PutApplType      = 11 (INTEGER)
    (0x03000000:NameValue):PutApplName      = 're MQ\java\jre\bin\javaw.exe' (CHARACTER)
    (0x03000000:NameValue):PutDate          = DATE '2012-09-24' (DATE)
    (0x03000000:NameValue):PutTime          = GMTTIME '09:27:39.700' (GMTTIME)
    (0x03000000:NameValue):ApplOriginData   = '    ' (CHARACTER)
    (0x03000000:NameValue):GroupId          = X'000000000000000000000000000000000000000000000000' (BLOB)
    (0x03000000:NameValue):MsgSeqNumber     = 1 (INTEGER)
    (0x03000000:NameValue):Offset           = 0 (INTEGER)
    (0x03000000:NameValue):MsgFlags         = 0 (INTEGER)
    (0x03000000:NameValue):OriginalLength   = -1 (INTEGER)
  )
  (0x01000000:Folder):XMLNSC     = ( ['xmlnsc' : 0x225aebb0]
    (0x01000400:NamespaceDecl):XmlDeclaration       = (
      (0x03000100:Attribute):Version  = '1.0' (CHARACTER)
      (0x03000100:Attribute):Encoding = 'UTF-8' (CHARACTER)
    )
    (0x01000000:Folder       )http://mytest/wor:wor = (
      (0x03000102:NamespaceDecl):xmlns                         = 'http://mytest/wor' (CHARACTER)
      (0x03000000:PCDataField  )http://mytest/wor:interface_id = 'wor' (CHARACTER)
      (0x03000000:PCDataField  )http://mytest/wor:aa           = 'aa' (CHARACTER)
      (0x03000000:PCDataField  )http://mytest/wor:bb           = 'bb' (CHARACTER)
    )
  )
)


Can someone enlighten me how to access interface_id? Thanks!
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon Sep 24, 2012 1:57 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Please read this info center page : http://publib.boulder.ibm.com/infocenter/wmbhelp/v8r0m0/topic/com.ibm.etools.mft.doc/ac67172_.htm
If you're still stuck, post your ESQL ( I think you intended to, but forgot )
Back to top
View user's profile Send private message
jfecq
PostPosted: Mon Sep 24, 2012 2:03 am    Post subject: Reply with quote

Apprentice

Joined: 24 Sep 2012
Posts: 36

Right..I forget to post the esql.

Code:
if InputRoot.XMLNSC.wor.interface_id = 'wor' then
SET OutputLocalEnvironment.Destination.RouterList.DestinationData[1].labelName = 'woc';


I read the link, but that is to set the outgoing namespace? I am actually looking to retrieve the interface_id, and not sure if the namespace is the problem.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Sep 24, 2012 2:31 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

jfecq wrote:
I read the link, but that is to set the outgoing namespace?




jfecq wrote:
I am actually looking to retrieve the interface_id, and not sure if the namespace is the problem.



_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon Sep 24, 2012 2:57 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

OK - did you read this as well?
http://publib.boulder.ibm.com/infocenter/wmbhelp/v7r0m0/topic/com.ibm.etools.mft.doc/ac67194_.htm

The element 'interface_id' in the message tree is in the namespace 'http://mytest/wor' ( as the user trace clearly shows ). Your ESQL needs to be adjusted to recognise that fact.
Back to top
View user's profile Send private message
jfecq
PostPosted: Mon Sep 24, 2012 5:57 pm    Post subject: Reply with quote

Apprentice

Joined: 24 Sep 2012
Posts: 36

Got it! Thanks!
Back to top
View user's profile Send private message
jfecq
PostPosted: Mon Sep 24, 2012 6:05 pm    Post subject: Reply with quote

Apprentice

Joined: 24 Sep 2012
Posts: 36

One more question.. is it better to package interface_id as message property or in the XML payload itself? In terms of

1) efficiency and performance in getting/setting interface_id
2) compatibility or other issues

I am able to set as message property via Java client and access in Broker via MQR2FH.usr
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Sep 25, 2012 12:44 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
A message flow processes these messages and by determining an element in the xml and route to a corresponding destination.
Sounds like you need a RouteToLabel node.
The interface id is meta-data ( data that describes other data ). If I had the choice, I would put it into a header. That way, the message could be routed without any need to parse the message body.
Back to top
View user's profile Send private message
jfecq
PostPosted: Tue Sep 25, 2012 1:07 am    Post subject: Reply with quote

Apprentice

Joined: 24 Sep 2012
Posts: 36

Yup I am using the RouteToLabel node.

I am evaluating both ways of putting the metadata as message property and inside the payload. As you suggested, putting into a header is more efficient as there is no need to parse the xml.

But I am concern if there will be any issues arising from different MQ version, say 6 and 7. What I understand is RFH2 can be changed by MQ? Therefore will there be a case where initially the metadata is gotten from MQRFH2.usr, but after a MQ upgrade, the flow breaks as the metadata is moved to somewhere else?

How about using different clients? Java properties are mapped to MQRFH2 but are other languages mapped similarly?

Thanks!
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Sep 25, 2012 1:55 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
I am concern if there will be any issues arising from different MQ version, say 6 and 7. What I understand is RFH2 can be changed by MQ? Therefore will there be a case where initially the metadata is gotten from MQRFH2.usr, but after a MQ upgrade, the flow breaks as the metadata is moved to somewhere else?
IBM's usually tries quite hard not to break users in that kind of way. Let's see what others think...

...nudge.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Sep 25, 2012 4:35 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

jfecq wrote:
But I am concern if there will be any issues arising from different MQ version, say 6 and 7. What I understand is RFH2 can be changed by MQ? Therefore will there be a case where initially the metadata is gotten from MQRFH2.usr, but after a MQ upgrade, the flow breaks as the metadata is moved to somewhere else?


Well you'd hope that whoever was doing the upgrade would be aware of the use of RFH2 in the estate for which they were responsible (or at least think to ask) and is sucj a mixed v6 & v7 environment would ensure any v7 queue managers were configured to permit the co-existance of these styles. As documented.

jfecq wrote:
How about using different clients? Java properties are mapped to MQRFH2 but are other languages mapped similarly?


Each API offers some properties support. Again as documented.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqsiuser
PostPosted: Tue Sep 25, 2012 9:16 pm    Post subject: Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

kimbert wrote:
MQRFH2.usr

the place to put your msg metadata... there is no (other) place like that ... I never had doubt in using it (I do use it ).

You could just dump data any way (put in a tree)... but afaiu thats not what it is was supposed to be (documented). Its for msg/jms properties (key name values)... some will say "don't refer to MQRFH2(.usr)" any more, just say "msg properties"... anyone to enlight us/me more is welcome.
_________________
Just use REFERENCEs
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » esql not able to access xml element
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.