Author |
Message
|
mqs_guy |
Posted: Thu Apr 15, 2004 6:26 pm Post subject: Accessing elements in a message |
|
|
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 |
|
 |
Missam |
Posted: Thu Apr 15, 2004 7:28 pm Post subject: |
|
|
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 |
|
 |
mqs_guy |
Posted: Fri Apr 16, 2004 10:37 am Post subject: |
|
|
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 |
|
 |
dkeister |
Posted: Fri Apr 16, 2004 11:41 am Post subject: |
|
|
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 |
|
 |
Missam |
Posted: Fri Apr 16, 2004 12:49 pm Post subject: |
|
|
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 |
|
 |
fschofer |
Posted: Fri Apr 16, 2004 1:19 pm Post subject: |
|
|
 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 |
|
 |
|