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 » Accessing elements in a message

Post new topic  Reply to topic
 Accessing elements in a message « View previous topic :: View next topic » 
Author Message
mqs_guy
PostPosted: Thu Apr 15, 2004 6:26 pm    Post subject: Accessing elements in a message Reply with quote

Acolyte

Joined: 09 May 2002
Posts: 71

Hi,

We are having problems accessing elements in a incoming message. Below is the message that comes to our queue.

************************************************************************************************
RFH  „  ¸MQSTR ¸ \<mcd><Msd>mrm</Msd><Set>OK10S5S002001</Set><Type>oramq_PRODUCT</Type><Fmt>CwXML</Fmt></mcd>
<?xml version="1.0" encoding="UTF-8"?>
<Q1:oramq_PRODUCT
xmlns:Q1="http://www.ibm.com/websphere/crossworlds/2002/BOSchema/oramq_PRODUCT" version="3.0.0" verb="Create" locale="en_US" delta="false">
<Q1:PRODNO>44</Q1:PRODNO>
<Q1:PRODNAME>testxml</Q1:PRODNAME>
<Q1:PRODTYP>ee</Q1:PRODTYP>
<Q1:ObjectEventId>JDBCConnector_100265xworlds_events2004-04-15 11:52:24.0</Q1:ObjectEventId>
</Q1:oramq_PRODUCT>

***********************************************************************************************


I believe the first part of the message is the header - MQRFH (see below)
************************************************
RFH  „  ¸MQSTR ¸ \<mcd><Msd>mrm</Msd><Set>OK10S5S002001</Set><Type>oramq_PRODUCT</Type><Fmt>CwXML</Fmt></mcd>

******************************

and the rest of it an XML message.

Now, after much research, I have the following esql in my compute node to access the element PRODNAME.

SET OutputRoot.MRM.PRODNAME= UPPER(InputBody.*[6]);

I am sure this is not the right way to access the element. Please let me know how do i access the elements for messages like these?

As always, our inputs are highly appreciated.

Cheers,
Vishal Agrawal
Back to top
View user's profile Send private message
Missam
PostPosted: Thu Apr 15, 2004 7:28 pm    Post subject: Reply with quote

Chevalier

Joined: 16 Oct 2003
Posts: 424

Quote:
RFH  „  ¸MQSTR ¸ \<mcd><Msd>mrm</Msd><Set>OK10S5S002001</Set><Type>oramq_PRODUCT</Type><Fmt>CwXML</Fmt></mcd>


You have both RFH and RFH2 headers in your message and the message looks like predefined XML.
one thing we need to keep in mind before starting mapping is the tree structure of the input message and the corresponding tree structure of output message.

SET OutputRoot.MRM.PRODNAME= UPPER(InputBody.*[6]);

the statement above defenetely works if you have an ELEMENT 'PRODNAME' defined in the MRM(message) and if you are sure that 6th field of the input message EXISTS.

If you are not able to process this means ,you must have some error reported to your log.
If you can give details on the error you are getting,that will be more useful to find a solution for the problem
Back to top
View user's profile Send private message
mqs_guy
PostPosted: Fri Apr 16, 2004 10:37 am    Post subject: Reply with quote

Acolyte

Joined: 09 May 2002
Posts: 71

Thanks for your reply sam.

I am able to access the element "PRODNAME" with the ESQL:
SET OutputRoot.MRM.PRODNAME= UPPER(InputBody.*[6]);

Was wondering if this is the right way of accessing it??

I tried various combinations like
1)
DECLARE Q1 NAMESPACE 'http://www.ibm.com/websphere/crossworlds/2001/BOSchema/oramq_PRODUCT';
SET OutputRoot.MRM.PRODNAME= UPPER(InputBody.Q1:PRODNAME);

2)
SET OutputRoot.MRM.PRODNAME= UPPER(InputBody."http://www.ibm.com/websphere/crossworlds/2002/BOSchema/oramq_PRODUCT:PRODNAME");

But it wouldn't parse!! When i did a trace, i always found the error:
'Failed to Navigate to Element' and 'The expression evaluated to NULL'.

Cheers,
Vishal Agrawal
Back to top
View user's profile Send private message
dkeister
PostPosted: Fri Apr 16, 2004 11:41 am    Post subject: Reply with quote

Disciple

Joined: 25 Mar 2002
Posts: 184
Location: Purchase, New York

If I understand your situation, you have the body of the input XML in your sample that starts with

<Q1:oramq_PRODUCT ...

If your input node message domain is XML, and you put your sample message to the queue and have a compute node that copies message headers and the following statement:

Set OutputRoot.XML.Prod.Name = InputRoot.XML."Q1:oramq_PRODUCT"."Q1:PRODNAME";

and you put the results to an output queue,

Your output message looks like:

<Prod>
<Name>testxml</Name>
</Prod>

Similarly,

Set OutputRoot.XML.Prod.Name = UPPER(InputRoot.XML."Q1:oramq_PRODUCT"."Q1:PRODNAME");

looks like:
<Prod>
<Name>TESTXML</Name>
</Prod>
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Missam
PostPosted: Fri Apr 16, 2004 12:49 pm    Post subject: Reply with quote

Chevalier

Joined: 16 Oct 2003
Posts: 424

Quote:
'Failed to Navigate to Element' and 'The expression evaluated to NULL'.

This clearly means that it has problem referencing the field

so what i suggest is to put a trace noce before your compute node and in pattern say {Body} this will print exact structure and elements it got .this can help you find how exactly the field looks like
Back to top
View user's profile Send private message
fschofer
PostPosted: Fri Apr 16, 2004 1:19 pm    Post subject: Reply with quote

Knight

Joined: 02 Jul 2001
Posts: 524
Location: Mainz, Germany

Hi, you got the PRODNAME as 6th element because your message
contains the folowing elements:

(XML.attr)version='3.0.0'
(XML.attr)verb='Create'
(XML.attr)locale='en_US'
(XML.attr)delta='false'
Q1:PRODNO='44'
Q1:PRODNAME='testxml'
Q1:PRODTYP='ee'
Q1:ObjectEventId='JDBCConnector_100265xworlds_events2004-04-15 11:52:24.0'

You can directly access the PRODNAME with
InputBody."Q1:PRODNAME" or InputRoot.MRM."Q1:PRODNAME"

If you want to see the access path to yor message elements
put a trace node before your compute node.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Accessing elements in a message
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.