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 » can't extract xml attributes in compute (iib v10)

Post new topic  Reply to topic Goto page 1, 2, 3  Next
 can't extract xml attributes in compute (iib v10) « View previous topic :: View next topic » 
Author Message
pavel112233
PostPosted: Tue Oct 04, 2016 7:13 am    Post subject: can't extract xml attributes in compute (iib v10) Reply with quote

Novice

Joined: 04 Oct 2016
Posts: 21

hi,

I have a very simple flow where I send message <a>1</a> into T1.in.

Then in Compute I try to save value of element 'a' to database table:

Code:
CREATE COMPUTE MODULE f_test_1_Compute
    CREATE FUNCTION Main() RETURNS BOOLEAN
    BEGIN
        CALL CopyMessageHeaders();
        CALL CopyEntireMessage();
        INSERT INTO Database.test1 (ID, val) VALUES (InputBody.a, 2)
        RETURN TRUE;
    END;

    CREATE PROCEDURE CopyMessageHeaders() BEGIN
        DECLARE I INTEGER 1;
        DECLARE J INTEGER;
        SET J = CARDINALITY(InputRoot.*[]);
        WHILE I < J DO
            SET OutputRoot.*[I] = InputRoot.*[I];
            SET I = I + 1;
        END WHILE;
    END;

    CREATE PROCEDURE CopyEntireMessage() BEGIN
        SET OutputRoot = InputRoot;
    END;
END MODULE;


Eventually I have this in my database table : null | 2 - first column is always null.

I tried all possible combinations referencing attribute 'a' , for example InputRoot.XMLNSC.a .

They all don't work, I always get NULL insted of attribute "a" value (which is "1"). However message properties like InputRoot.Properties.Encoding work fine, I get normal value in this case.

Perhaps this is very lame question but I'm a total newbie in this IIB business, please help!
Back to top
View user's profile Send private message
pavel112233
PostPosted: Tue Oct 04, 2016 7:14 am    Post subject: Reply with quote

Novice

Joined: 04 Oct 2016
Posts: 21

link to the image of the flow:
https://www.ibm.com/developerworks/community/forums/ajax/download?nodeId=8c1a6068-3351-4ced-ab14-561cb124d46e
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Oct 04, 2016 7:24 am    Post subject: Re: can't extract xml attributes in compute (iib v10) Reply with quote

Grand High Poobah

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

pavel112233 wrote:
I tried all possible combinations referencing attribute 'a' , for example InputRoot.XMLNSC.a .


In this example, a is an element not an attribute.

pavel112233 wrote:
I have a very simple flow where I send message <a>1</a> into T1.in.


What's "T1.in"? Sounds like an MQ queue, but could be a file or an oddly named web service. You need to tell us these things.

Whatever it is, does the input node parse the message with XMLNSC or have you left it as BLOB? If so, InputRoot.XMLNSC will be null because the payload is in InputRoot.BLOB.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Oct 04, 2016 7:25 am    Post subject: Re: can't extract xml attributes in compute (iib v10) Reply with quote

Grand High Poobah

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

Vitor wrote:
What's "T1.in"? Sounds like an MQ queue, but could be a file or an oddly named web service. You need to tell us these things.


OK, just noticed your picture, it's a queue.

I repeat my question about message domain.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
pavel112233
PostPosted: Tue Oct 04, 2016 7:36 am    Post subject: Reply with quote

Novice

Joined: 04 Oct 2016
Posts: 21

Vitor, thanx for reply!
InputRoot.BLOB.a doesnt't work either.
Property of T1.in : Input message parsing-> message domian = XMLNSC For xml messages ....
if you mean that.
Back to top
View user's profile Send private message
timber
PostPosted: Tue Oct 04, 2016 7:41 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

I would attach the debugger or take a user trace. Have you done either of those yet?
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Oct 04, 2016 7:42 am    Post subject: Reply with quote

Grand High Poobah

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

pavel112233 wrote:
InputRoot.BLOB.a doesnt't work either.


It won't. The BLOB domain doesn't subdivide.

pavel112233 wrote:
Property of T1.in : Input message parsing-> message domian = XMLNSC For xml messages ....
if you mean that.


I do mean that. And that is the right setting for an XML message.

Your next step is to add a Trace node after the MQInput node and take a user trace. This will tell you:

- what IIB thinks the input XML looks like, which clearly differs from what you think it looks like
- what the Compute node is doing to try and find the element
- how to debug a misbehaving flow without recourse to posting requests for help on Internet forums, where a bunch of strangers may eventually respond.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
pavel112233
PostPosted: Tue Oct 04, 2016 8:02 am    Post subject: Reply with quote

Novice

Joined: 04 Oct 2016
Posts: 21

Vitor, I'm sorry for not doing debug and bugging the internet forums..
so here's the rusult of the trace:
Error time: 2016-10-04 18:58:50.990338
Exception:
( ['xmlnsc' : 0xfdc44f0]
(0x03000000:PCDataField):a = '1' (CHARACTER)
)
what is this suppose to mean?

trace pattern =
Error time: ${CURRENT_TIMESTAMP}
Exception:
${Body}
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Oct 04, 2016 8:38 am    Post subject: Reply with quote

Grand High Poobah

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

pavel112233 wrote:
Vitor, I'm sorry for not doing debug and bugging the internet forums..


Don't be. At some point we've all posted questions here; my comment was intended to point out it's faster and more efficient to troubleshoot yourself.

It also means you can supplement your question with details like this:

pavel112233 wrote:

so here's the rusult of the trace:
Error time: 2016-10-04 18:58:50.990338
Exception:
( ['xmlnsc' : 0xfdc44f0]
(0x03000000:PCDataField):a = '1' (CHARACTER)
)
what is this suppose to mean?


It means that IIB has decided the "a" isn't an element but a CData field. So the construction:

Code:
InputBody.a


or

Code:
InputRoot.XMLNSC.a


won't work because the default is XMLNSC.Field.

If you change your code to:

Code:
InputRoot.XMLNSC.(XMLNSC.CDataValue)a


then you should see the value. But that's not the problem.

The XML <a>1</a> is mixed content and unusual, hence the way the parser has reacted. It should be something like <TestRoot><a>1</a></TestRoot>. You should then see a described as an Element in the trace, and you can reference it with:

Code:
InputRoot.XMLNSC.TestRoot.a


Enjoy the fish.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
pavel112233
PostPosted: Tue Oct 04, 2016 10:06 am    Post subject: Reply with quote

Novice

Joined: 04 Oct 2016
Posts: 21

<TestRoot><a>1</a></TestRoot> + InputRoot.XMLNSC.TestRoot.a
doesn't work. The log is:

Error time: 2016-10-04 21:01:20.324204
Exception:
( ['xmlnsc' : 0xfdc44f0]
(0x01000000:Folder):TestRoot = (
(0x03000000:PCDataField):a = '1' (CHARACTER)
)
)
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Oct 04, 2016 11:18 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Could you show us the XML you're getting in (names changed to protect the annoying) with the XML you're trying to produce?
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
pavel112233
PostPosted: Tue Oct 04, 2016 11:20 am    Post subject: Reply with quote

Novice

Joined: 04 Oct 2016
Posts: 21

Code:
<a>1</a>
InputRoot.XMLNSC.(XMLNSC.CDataValue)a

- this idea doesn't work for me either. log:
Code:
Error time: 2016-10-04 22:17:45.581376
Exception:
( ['xmlnsc' : 0xfdc44f0]
  (0x03000000:PCDataField):a = '1' (CHARACTER)
)
Back to top
View user's profile Send private message
pavel112233
PostPosted: Tue Oct 04, 2016 11:22 am    Post subject: Reply with quote

Novice

Joined: 04 Oct 2016
Posts: 21

mqjeff wrote:
Could you show us the XML you're getting in (names changed to protect the annoying) with the XML you're trying to produce?

what do you mean by " the XML you're getting in"
isn't it <TestRoot><a>1</a></TestRoot> ?
Back to top
View user's profile Send private message
pavel112233
PostPosted: Tue Oct 04, 2016 11:24 am    Post subject: Reply with quote

Novice

Joined: 04 Oct 2016
Posts: 21

mqjeff wrote:
Could you show us the XML you're getting in (names changed to protect the annoying) with the XML you're trying to produce?


i have this message on the input of compute node:
https://www.ibm.com/developerworks/community/forums/ajax/download?nodeId=5a766c4b-28de-42d5-a841-f490d8115b81
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Oct 04, 2016 11:42 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

A minor point is that you are calling both CopyMessageHeaders and CopyEntireMessage.

It's not an issue, the CopyEntireMessage will recopy all the things CopyMessageHeaders did.

It looks like you're trying to insert a value into a DB. Presumably at this point you're able to get the right value to send to the DB...

Regardless, your flow still seems not to work? So can you show us what happens - the error or etc.
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2, 3  Next Page 1 of 3

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » can't extract xml attributes in compute (iib v10)
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.