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 » Problem reading XML attribute from Inputmessage.

Post new topic  Reply to topic
 Problem reading XML attribute from Inputmessage. « View previous topic :: View next topic » 
Author Message
lrasalas01
PostPosted: Fri Jul 25, 2008 12:14 am    Post subject: Problem reading XML attribute from Inputmessage. Reply with quote

Novice

Joined: 16 Jul 2008
Posts: 14

Hello everybody,

I am reading XML into a fixed length text message.
I am having problem reading XML attribute values from input message in XML domain. I have tried following thing but nothing happens; not even an error.(Output message is generated without attribute values).

Code:

SET OutputRoot.MRM.ListOfAction.Action.MessageID = InputRoot.XML.SMessage.(XML.Attribute)MessageId;


My XML message is in following format.

Code:

<SMessage MessageId="00000001">
  <ListOfAction>
    <Action>
        <QmgrName>TSTENV01</QmgrName>
         ...
    </Action>
  </ListOfAction>
</SMessage>


I could convert normal element values (like QmgrName) to fixed length string without problem.

Thanks,
LR
Back to top
View user's profile Send private message
marko.pitkanen
PostPosted: Fri Jul 25, 2008 12:23 am    Post subject: Reply with quote

Chevalier

Joined: 23 Jul 2008
Posts: 440
Location: Jamsa, Finland

Hi,

Have you looked / searched from user trace how broker parses the incoming message? I have found that while developing it is a very good habit to echo incoming message before mapping and outgoing message after and see if I can find hints from there what can be wrong.

Marko
Back to top
View user's profile Send private message Visit poster's website
kimbert
PostPosted: Fri Jul 25, 2008 12:36 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Hi lrasalas01,

- Please stop using the XML domain. It is deprecated. Use XMLNSC for all new message flows.
- Put a Trace node after your input node and set the Pattern property to '${Root}'. Take a user trace ( debug level ), and you will see the message tree ( and lot of other useful info ) in the user trace.

If you don't know how to take a user trace, look up mqsichangetrace, mqsireadlog, mqsiformatlog in the docs.
Back to top
View user's profile Send private message
lrasalas01
PostPosted: Fri Jul 25, 2008 2:32 am    Post subject: Reply with quote

Novice

Joined: 16 Jul 2008
Posts: 14

Marko, Kimbert,

I took the trace and found that message is being generated as follows.
Code:
{HEADER DATA UPTO HERE}(0x01000021):MRM = ( (0x0300000D):@MessageId = 'xxx' (0x01000013):ListOfAction = ( (0x01000013):Action = ( (0x0300000B):QmgrName = .......


kimbert, I am sorry, let me correct myself. I am actually using MRM domain with input message format of XML. So I have to use this statement to access child elements of Action tag and it works fine.

Code:
InputRoot.MRM.ListOfAction.Action.QmgrName

Now the problem is I can't refer to attribute like InputRoot.MRM.attributeName

Is there any other way to achive this?

By the way, I am working on older versions.
OS: Solaris 5.9
Message Broker Toolkit: 5.0.3
WebSphere MQ 530.7 CSD07
Back to top
View user's profile Send private message
marko.pitkanen
PostPosted: Fri Jul 25, 2008 3:08 am    Post subject: Reply with quote

Chevalier

Joined: 23 Jul 2008
Posts: 440
Location: Jamsa, Finland

LR,

I have seen this before --somehow-- with MRM broker parses xml attributes with @ -prefix.

So you have to refer to it like SET OutputRoot.MRM.ListOfAction.Action.MessageID = InputRoot.MRM.SMessage.@MessageId;

Marko
Back to top
View user's profile Send private message Visit poster's website
marko.pitkanen
PostPosted: Fri Jul 25, 2008 3:13 am    Post subject: Reply with quote

Chevalier

Joined: 23 Jul 2008
Posts: 440
Location: Jamsa, Finland

And to be precise --no SMessage root tag reference needed.

SET OutputRoot.MRM.ListOfAction.Action.MessageID = InputRoot.MRM.@MessageId;

Marko
Back to top
View user's profile Send private message Visit poster's website
kimbert
PostPosted: Fri Jul 25, 2008 3:31 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
I have seen this before --somehow-- with MRM broker parses xml attributes with @ -prefix. So you have to refer to it like SET OutputRoot.MRM.ListOfAction.Action.MessageID = InputRoot.MRM.SMessage.@MessageId;
Please ignore that piece of advice.
If the MRM parser puts an '@' prefix on an attribute, it means that the attribute was self-defining ( it was not found in the message definition). That is a serious problem which should be fixed.

Obviously, this is not an issue in v6.1 - nobody would want to use MRM XML in v6.1, would they?
Back to top
View user's profile Send private message
marko.pitkanen
PostPosted: Fri Jul 25, 2008 3:51 am    Post subject: Reply with quote

Chevalier

Joined: 23 Jul 2008
Posts: 440
Location: Jamsa, Finland

Thanks Kimbert for the correction. Now we/I know the reason for the @ -prefixes ;.)

Marko
Back to top
View user's profile Send private message Visit poster's website
marko.pitkanen
PostPosted: Fri Jul 25, 2008 4:49 am    Post subject: Reply with quote

Chevalier

Joined: 23 Jul 2008
Posts: 440
Location: Jamsa, Finland

Hi all,

I searched a little and it is still allowed(?) to use self-defined elements with MRM / XML physical format, but as Kimbert denoted it is perhaps better to correct the message model to contain all attributes & elements?

Marko

Quote:

WebSphere Message Broker 6.1 Information Center

MRM XML physical format
.
.
.
XML messages are, by their nature, self-describing: each piece of data is prefixed by a tag name or an attribute name. Therefore, it is possible for an XML message instance to contain elements which are not in the definition for that message.

* If such an element exists in the message set, the model objects for that element are used in parsing or writing the message.
* If the element does not exist in the message set, it is treated as a self-defining element and its data type is set to string.
Back to top
View user's profile Send private message Visit poster's website
kimbert
PostPosted: Fri Jul 25, 2008 5:03 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Hi marko,

Yes, if your attributes are self-defining by design then that's OK. But you just told lrasalas01 to add an '@' to his ESQL path. You didn't say anything about checking whether the attribute should be self-defining.
Any advice which you or I provide on this thread might be read and acted upon by other people. That's why I posted that reply.
Back to top
View user's profile Send private message
lrasalas01
PostPosted: Mon Jul 28, 2008 3:19 am    Post subject: Reply with quote

Novice

Joined: 16 Jul 2008
Posts: 14

Hi Kimbert,

As per you said, there was a difference of definition between input message and output message set. I had a hunch about that. Should have looked in that direction at the first place.

I redefined both the message sets (since there were other differences too like lengths of fixed-length-string fields etc) and now it works perfectly.

I can access the attributes of a root element just by InputRoot.MRM.attribteName

Quote:
Obviously, this is not an issue in v6.1 - nobody would want to use MRM XML in v6.1, would they?


You are absolutely right, if I had an option I wouldn't use MRM. But right now I am stuck with the maintenance of this old message flow. No choice!

Thanks for the replies,
LR
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 » Problem reading XML attribute from Inputmessage.
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.