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 » Compute Node problems

Post new topic  Reply to topic Goto page 1, 2  Next
 Compute Node problems « View previous topic :: View next topic » 
Author Message
max power
PostPosted: Thu Sep 06, 2007 8:24 am    Post subject: Compute Node problems Reply with quote

Apprentice

Joined: 06 Sep 2007
Posts: 31

Hi, I'm a complete newbie so please be nice.
I am trying to use the compute node for the first time and am having a few problems which I can't work out.
I put this message on the input node:

<?xml version="1.0 encoding="UTF-8"?>
<Message>
<Firstname>MAX</Firstname>
<Surname>POWER</Surname>
<House_no>13</House_no>
<Postcode>SW191XX</Postcode>
</Message>

I set the message domain to XMLNS.
My compute node reads as follows:

CREATE COMPUTE MODULE XML_XFER_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
CALL CopyEntireMessage();
RETURN TRUE;
END;

CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER;
DECLARE J INTEGER;
SET I = 1;
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.XML.Message.Firstname = InputRoot.XML.Message.Firstname;
SET OutputRoot.XML.Message.Surname = 'Smith';
END;


END MODULE;

(all I want to output is the first name and change the surname to 'Smith'. This is just a simple test on how the compute node works).

The unchanged message is sent straight out via the 'Failure' terminal and I don't get any errors in the log.
I bet I'm doing something stupid but I can't seem to work it out.

Can anyone help?

edit: I am using rfhutil to put this message on the input queue and am on a WinXP environment.
Back to top
View user's profile Send private message
Krayvyn
PostPosted: Thu Sep 06, 2007 8:46 am    Post subject: Reply with quote

Novice

Joined: 08 Jun 2005
Posts: 12

Looks good for your first time.

Remember calling CopyMessageHeaders() and CopyEntireMessage() is redundant. You probably just want CopyMessageHeaders in your case.

How did you set the Message Domain to XMLNS? On the input node?

What output are you getting? What version are you using?

At first glance your code looks good.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Sep 06, 2007 10:21 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Okay, it looks like you've change the implementation of CopyEntireMessage().

This is bad, as it will confuse everyone who ever has to change your code.

Restore the original contents - or delete the whole esql file and start again.

Then put your specific code directly in the Main function - after calling ONLY CopyMessageHeaders OR CopyEntireMessage.

And if your Domain is XMLNS, then you need to Set OutputRoot.XMLNS...
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
asudhakar
PostPosted: Thu Sep 06, 2007 10:37 pm    Post subject: Reply with quote

Centurion

Joined: 12 May 2007
Posts: 116
Location: Bangalore

Ur code was running successfully.
Just check it.

CREATE COMPUTE MODULE JsMFlow_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
CALL CopyEntireMessage();
RETURN TRUE;
END;

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

CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot.XML.Message.Firsname = InputRoot.XML.Message.Firstname;
SET OutputRoot.XML.Message.Surname = 'Smith';
END;
END MODULE;


Message Flow : MQInput -> Comput -> MQOutput.
MQInput node Message domain property : XML
(prefer XMLNS domain.)

Input : <Message><Firstname>MAX</Firstname><Surname>POWER</Surname><House_no>13</House_no><Postcode>SW191XX</Postcode></Message>
Output :
<Message><Firsname>MAX</Firsname><Surname>Smith</Surname></Message>
_________________
WebSphere MQ, MB Support and Admin
Back to top
View user's profile Send private message Send e-mail
max power
PostPosted: Fri Sep 07, 2007 1:19 am    Post subject: Reply with quote

Apprentice

Joined: 06 Sep 2007
Posts: 31

Thanks for the help people. I've got it working now.
However, that is a simple test of the compute node over, now for the more detailed ESQL.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Sep 07, 2007 3:43 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

I'm sorry, your code is still wrong.

You are using XML domain, and not XMLNS or XMLNSC.

This is bad. Use XMLNS or XMLNSC.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
max power
PostPosted: Fri Sep 07, 2007 4:39 am    Post subject: Reply with quote

Apprentice

Joined: 06 Sep 2007
Posts: 31

Hi Jeff,

I am now using XMLNS. That's one of the changes I did to get it working.

Thanks.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Sep 07, 2007 4:41 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Okay, I saw asudhakar's code, and figured you were using that.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
max power
PostPosted: Mon Sep 10, 2007 12:43 am    Post subject: Reply with quote

Apprentice

Joined: 06 Sep 2007
Posts: 31

I have another issue now. My compute node seems to be working without any problems unless I try and extract data from an XML tag that contains a description.
How would I extract data from the below XML..?
<XMLTag Description = "Text" DATA:LineType="1">
<Data>TEST</Data>
</XMLTag>

I assume this has something to do with namespaces but if I use the ESQL below, I don't seem to get any data back:

SET OutputRoot.XMLNS.Test.Data = InputRoot.XMLNS.XMLTag.Data;

This code does not populate any data and the field Test>Data is left out of the Output message.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Sep 10, 2007 2:27 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

max power wrote:

How would I extract data from the below XML..?
<XMLTag Description = "Text" DATA:LineType="1">
<Data>TEST</Data>
</XMLTag>

I assume this has something to do with namespaces but if I use the ESQL below, I don't seem to get any data back:

SET OutputRoot.XMLNS.Test.Data = InputRoot.XMLNS.XMLTag.Data;

This code does not populate any data and the field Test>Data is left out of the Output message.


Have you tried
Code:
SET OutputRoot.XMLNS.Test.Data = InputRoot.XMLNS.*:XMLTag.Data;

The other option to check is whether XMLTag is a legal element in XML.

Use a trace node before your compute node and show us the output...
Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
max power
PostPosted: Mon Sep 10, 2007 2:36 am    Post subject: Reply with quote

Apprentice

Joined: 06 Sep 2007
Posts: 31

I'm not actualling using 'XML Tag', this is just used as an example.
I'll try what you've suggested though.
UPDATE:
The '.*:' hasn't appeared to do anything.
The actual data I want to extract is the field ItemID from the XML below:
<Transaction>
<RetailTransaction Version="1.0" TransactionStatus="Status">
<LineItem EntryMethod="Input" ABMN:LineType="1">
<Sale>
<Identity Type="MAP">
<ItemID>12345678</ItemID>
</Identity>
</Sale>
</LineItem>
</RetailTransaction>
</Transaction>

If I use the code SET OutputRoot.XMLNS.Header.Item.Data = InputRoot.XMLNS.Transaction.*:RetailTransaction.LineItem.Sale.Identity.ItemID, nothing is returned, not even the Output field.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Sep 10, 2007 3:04 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

SET OutputRoot.XMLNS.Header.Item.Data = InputRoot.XMLNS.*:Transaction.*:RetailTransaction.*:LineItem.*:Sale.*:Identity.*:ItemID;

As I said, show us the output of the trace node...
May be the message is not what you think it is?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
max power
PostPosted: Mon Sep 10, 2007 4:56 am    Post subject: Reply with quote

Apprentice

Joined: 06 Sep 2007
Posts: 31

Yep, that's worked now. Thanks very much.
Back to top
View user's profile Send private message
bdrummond
PostPosted: Mon Sep 10, 2007 5:17 am    Post subject: Reply with quote

Disciple

Joined: 06 May 2004
Posts: 164

Not the same problem but I thought I'd put it in here....
How do I use part of an XML tag in my IF statement?
EG,
If my XML tag is : <DATA Mode="Message">1</DATA>
How would I write an IF statement using the Mode="Message" as part of my statment?

ie, IF Mode='Message'
SET OutputRoot.Text = 'New';
ELSE
SET OutputRoot.Text = 'Old';
END IF;
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Sep 10, 2007 5:51 am    Post subject: Reply with quote

Grand High Poobah

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

Identify "Mode" as an XML Attribute rather than the default of Element.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Compute Node problems
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.