Author |
Message
|
nathanw |
Posted: Wed Jan 26, 2005 6:31 am Post subject: Simple problem really annoying me |
|
|
 Knight
Joined: 14 Jul 2004 Posts: 550
|
Ok have an xml message going thru a filter node
structure is as follows (generic data)
<?xml version="1.0"?>
<XML type="DispenseNotification">
<Header>
<MsgType>DispenseNotification</MsgType>
<StoreID>1234</StoreID>
<DateTime>25/01/2005 11:30</DateTime>
<Pharmacist ID="67890">
<Forename>Bill</Forename>
<Surname>Smith</Surname>
</Pharmacist>
</Header>
<DispenseNotification>
<TokenID>6374923909529836589023705293</TokenID>
<Status ID="0003">
<ReasonCode>21</ReasonCode>
</Status>
<Items>
<Item ID="1">
<Status ID="04">
<ReasonCode>76</ReasonCode>
</Status>
<Quantity>28</Quantity>
<SNOMED>978357282</SNOMED>
</Item>
<Item ID="2">
<Status ID="03"/>
<Quantity>14</Quantity>
<SNOMED>924787503</SNOMED>
</Item>
</Items>
</DispenseNotification>
</XML>
when i am filtering :-
a) InputRoot is not valid (damn annoying)
b) have tried all variations and still cannot get the filter to perform
esql as follows
CREATE FILTER MODULE ???????Filter
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
DECLARE MSGTYPE CHAR;
SET MSGTYPE = "Body"."XML"."Header"."MsgType";
IF MSGTYPE = 'DispenseNotification' THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
END;
END MODULE;
in usertrace debug i get the following for this variation
2005-01-26 14:07:36.209632 3840 UserTrace BIP2538I: Node ?????Filter': Evaluating expression 'Body.XML.Header.MsgType' at (.?????Filter.Main, 14.15).
2005-01-26 14:07:36.209709 3840 UserTrace BIP2543E: Node '??????? Filter': (?????_Filter.Main, 14.2 : Failed to navigate to path element because it does not exist.
2005-01-26 14:07:36.209785 3840 UserTrace BIP2537I: Nod
yes i know it is simple but it is a matter of not seeing wood for the trees at the moment
any ideas folks would be greatly appreciated
platform is wbi5 with FP4 on windows xp (is development)
Cheers |
|
Back to top |
|
 |
mgk |
Posted: Wed Jan 26, 2005 6:36 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Hi,
You can use either:
Code: |
SET MSGTYPE = Root.XML.Header.MsgType; |
or
Code: |
SET MSGTYPE = Body.Header.MsgType; |
but not:
Code: |
SET MSGTYPE = Body.XML.Header.MsgType; |
As Body is defined to be the "last child of Root" which I believe is 'XML' in your case.
Cheers, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
nathanw |
Posted: Wed Jan 26, 2005 6:38 am Post subject: |
|
|
 Knight
Joined: 14 Jul 2004 Posts: 550
|
lol cheers will try
have been using this stuff for a few years now and its teh simple things that trip me up!
gimme harcore complex stuff anyday! |
|
Back to top |
|
 |
nathanw |
Posted: Wed Jan 26, 2005 6:52 am Post subject: |
|
|
 Knight
Joined: 14 Jul 2004 Posts: 550
|
well neither of them worked!!!!!!!!!!!!!
is damn annoying i just cannot see the problem! its obviously something to do with the message or the structure (welll durh!!!!!!!!!)
will keep trying different permutations unless someone can spot it! |
|
Back to top |
|
 |
JT |
Posted: Wed Jan 26, 2005 7:15 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Quote: |
<?xml version="1.0"?>
<XML type="DispenseNotification">
<Header>
<MsgType>DispenseNotification</MsgType>
<StoreID>1234</StoreID>
<DateTime>25/01/2005 11:30</DateTime>
<Pharmacist ID="67890">
<Forename>Bill</Forename>
<Surname>Smith</Surname>
</Pharmacist>
</Header>
<DispenseNotification>
<TokenID>6374923909529836589023705293</TokenID>
<Status ID="0003">
<ReasonCode>21</ReasonCode>
</Status>
<Items>
<Item ID="1">
<Status ID="04">
<ReasonCode>76</ReasonCode>
</Status>
<Quantity>28</Quantity>
<SNOMED>978357282</SNOMED>
</Item>
<Item ID="2">
<Status ID="03"/>
<Quantity>14</Quantity>
<SNOMED>924787503</SNOMED>
</Item>
</Items>
</DispenseNotification>
</XML> |
Looks like 'XML' is the name of the parent tag, so it has to be included in the element path. Try this:
Code: |
SET MSGTYPE = "Root"."XML"."XML"."Header"."MsgType"; |
|
|
Back to top |
|
 |
nathanw |
Posted: Wed Jan 26, 2005 7:19 am Post subject: |
|
|
 Knight
Joined: 14 Jul 2004 Posts: 550
|
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Jan 26, 2005 8:20 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Post a trace of the message. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
nathanw |
Posted: Wed Jan 26, 2005 8:26 am Post subject: |
|
|
 Knight
Joined: 14 Jul 2004 Posts: 550
|
jeff
as requested
this may or may not be teh final version of the message but am working on this for now.
they may not have a MSGTYPE field in there but use the attribute under XML
but concentrate on this for now
(
(0x01000000):Properties = (
(0x03000000):MessageSet = ''
(0x03000000):MessageType = ''
(0x03000000):MessageFormat = ''
(0x03000000):Encoding = 546
(0x03000000):CodedCharSetId = 437
(0x03000000):Transactional = TRUE
(0x03000000):Persistence = FALSE
(0x03000000):CreationTime = GMTTIMESTAMP '2005-01-26 12:58:30.780'
(0x03000000):ExpirationTime = -1
(0x03000000):Priority = 0
(0x03000000):ReplyIdentifier = X'000000000000000000000000000000000000000000000000'
(0x03000000):ReplyProtocol = 'MQ'
(0x03000000):Topic = NULL
)
(0x01000000):MQMD = (
(0x03000000):SourceQueue = 'LLOYDS.INPUT.FROM.STORE'
(0x03000000):Transactional = TRUE
(0x03000000):Encoding = 546
(0x03000000):CodedCharSetId = 437
(0x03000000):Format = ' '
(0x03000000):Version = 2
(0x03000000):Report = 0
(0x03000000):MsgType = 8
(0x03000000):Expiry = -1
(0x03000000):Feedback = 0
(0x03000000):Priority = 0
(0x03000000):Persistence = 0
(0x03000000):MsgId = X'414d51204c4c4f594453514d20202020fe1cf54120002226'
(0x03000000):CorrelId = X'000000000000000000000000000000000000000000000000'
(0x03000000):BackoutCount = 0
(0x03000000):ReplyToQ = ' '
(0x03000000):ReplyToQMgr = 'LLOYDSQM '
(0x03000000):UserIdentifier = 'WilsonN '
(0x03000000):AccountingToken = X'160105150000009a734c485b1a5c15b00ea55a0151000000000000000000000b'
(0x03000000):ApplIdentityData = ' '
(0x03000000):PutApplType = 11
(0x03000000):PutApplName = 'onN\My Documents\rfhutil.exe'
(0x03000000):PutDate = DATE '2005-01-26'
(0x03000000):PutTime = GMTTIME '12:58:30.780'
(0x03000000):ApplOriginData = ' '
(0x03000000):GroupId = X'000000000000000000000000000000000000000000000000'
(0x03000000):MsgSeqNumber = 1
(0x03000000):Offset = 0
(0x03000000):MsgFlags = 0
(0x03000000):OriginalLength = -1
)
(0x01000010):XML = (
(0x05000018):XML = (
(0x06000011): = '1.0'
)
(0x06000002): = '
'
(0x01000000):XML = (
(0x03000000):type = 'DispenseNotification'
(0x02000000): = '
'
(0x01000000):Header = (
(0x02000000): = '
'
(0x01000000):MsgType = (
(0x02000000): = 'DispenseNotification'
)
(0x02000000): = '
'
(0x01000000):StoreID = (
(0x02000000): = '1234'
)
(0x02000000): = '
'
(0x01000000):DateTime = (
(0x02000000): = '25/01/2005 11:30'
)
(0x02000000): = '
'
(0x01000000):Pharmacist = (
(0x03000000):ID = '67890'
(0x02000000): = '
'
(0x01000000):Forename = (
(0x02000000): = 'Bill'
)
(0x02000000): = '
'
(0x01000000):Surname = (
(0x02000000): = 'Smith'
)
(0x02000000): = '
'
)
(0x02000000): = '
'
)
(0x02000000): = '
'
(0x01000000):DispenseNotification = (
(0x02000000): = '
'
(0x01000000):TokenID = (
(0x02000000): = '6374923909529836589023705293'
)
(0x02000000): = '
'
(0x01000000):Status = (
(0x03000000):ID = '0003'
(0x02000000): = '
'
(0x01000000):ReasonCode = (
(0x02000000): = '21'
)
(0x02000000): = '
'
)
(0x02000000): = '
'
(0x01000000):Items = (
(0x02000000): = '
'
(0x01000000):Item = (
(0x03000000):ID = '1'
(0x02000000): = '
'
(0x01000000):Status = (
(0x03000000):ID = '04'
(0x02000000): = '
'
(0x01000000):ReasonCode = (
(0x02000000): = '76'
)
(0x02000000): = '
'
)
(0x02000000): = '
'
(0x01000000):Quantity = (
(0x02000000): = '28'
)
(0x02000000): = '
'
(0x01000000):SNOMED = (
(0x02000000): = '978357282'
)
(0x02000000): = '
'
)
(0x02000000): = '
'
(0x01000000):Item = (
(0x03000000):ID = '2'
(0x02000000): = '
'
(0x01000000):Status = (
(0x03000000):ID = '03'
)
(0x02000000): = '
'
(0x01000000):Quantity = (
(0x02000000): = '14'
)
(0x02000000): = '
'
(0x01000000):SNOMED = (
(0x02000000): = '924787503'
)
(0x02000000): = '
'
)
(0x02000000): = '
'
)
(0x02000000): = '
'
)
(0x02000000): = '
'
)
(0x06000002): = '
'
)
) |
|
Back to top |
|
 |
JT |
Posted: Wed Jan 26, 2005 12:09 pm Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
This should work. I ran a quick test using your XML message and was able to successfully navigate to the MsgType element:
Code: |
SET MSGTYPE = Root.XML.(XML.Element)"XML".Header.MsgType; |
|
|
Back to top |
|
 |
nathanw |
Posted: Thu Jan 27, 2005 5:12 am Post subject: now with a twist |
|
|
 Knight
Joined: 14 Jul 2004 Posts: 550
|
heh typical really i get everything running and they change how it wants to be done
now the message is as follows
<?xml version="1.0"?>
<XML type="DispenseNotification">
<Header>
<StoreID>1234</StoreID>
<DateTime>25/01/2005 11:30</DateTime>
<Pharmacist ID="67890">
<Forename>Bill</Forename>
<Surname>Smith</Surname>
</Pharmacist>
</Header>
an dthe filtering mustbe done on the XML type description. In this case DispenseNotification
Any help appreciated as this again seems like i have been looking at it all wrong.
ahhh for the days of CICS integration etc
so if anyone can route this based on the type many thanks
N |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Jan 27, 2005 5:30 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
The only thing that has changed is the way you access the field you want.
The old field was an XML Element with a specific name at a specific location.
The new field is an XML Attribute with a specific name at a specific location.
You should take the time now to learn the basics of accessing different types of data, so that you do not have to struggle with it every time. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
nathanw |
Posted: Thu Jan 27, 2005 5:32 am Post subject: |
|
|
 Knight
Joined: 14 Jul 2004 Posts: 550
|
jeff
i agree
prob is i dont normally do this area its the more complex side
hehe
ah well
will get this sorted
cheers mate |
|
Back to top |
|
 |
JT |
Posted: Thu Jan 27, 2005 6:28 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Code: |
SET MSGTYPE = Root.XML.(XML.Element)"XML".(XML.Attribute)type; |
|
|
Back to top |
|
 |
nathanw |
Posted: Thu Jan 27, 2005 6:47 am Post subject: |
|
|
 Knight
Joined: 14 Jul 2004 Posts: 550
|
|
Back to top |
|
 |
JT |
Posted: Thu Jan 27, 2005 8:43 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Well, that ESQL statement worked successfully for me, as well as the following ESQL statement:
Code: |
SET MSGTYPE = FIELDVALUE(Root.XML.(XML.Element)"XML".(XML.Attribute)type); |
That's all I have to offer. Good luck. |
|
Back to top |
|
 |
|