Author |
Message
|
mq_crazy |
Posted: Wed Feb 02, 2005 8:38 am Post subject: simple ESQL |
|
|
 Master
Joined: 30 Jun 2004 Posts: 295
|
I am new to WBIMB and trying to learn. I just have a simple ESQL that i am trying to compare the firstname of the incoming message and if its true changin the name to a different one. I have MQinput,compute and Mqoutput node. Here is my ESQL, when i put test message it doesn't change the firstname, please tell me where i am wrong...
CREATE COMPUTE MODULE TEST_FLOW_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
CALL CopyEntireMessage();
CALL TEST();
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= InputRoot;
END;
CREATE PROCEDURE TEST() BEGIN
IF InputRoot.XML.Invoice.Firstname='rick' THEN
SET OutputRoot.XML.Invoice.Firstname='mick';
END IF;
END;
and here is the input test message
<Invoice><Firstname>rick</Firstname><Lastname>jen</Lastname><Contact>11111</contact></Invoice> |
|
Back to top |
|
 |
EddieA |
Posted: Wed Feb 02, 2005 9:49 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Quote: |
CALL CopyMessageHeaders();
CALL CopyEntireMessage(); |
You should only use one of these, depending on what you do in the rest of the EQSL.
What is the default Domain set in the Input Node. It should be "XML".
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
mq_crazy |
Posted: Wed Feb 02, 2005 10:06 am Post subject: |
|
|
 Master
Joined: 30 Jun 2004 Posts: 295
|
Thanks a lot for your reply. I changed the input to XML and it works. What abt i want to change one field and copy all the other fields exactly to the output |
|
Back to top |
|
 |
JT |
Posted: Wed Feb 02, 2005 11:05 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Quote: |
Quote:
CALL CopyMessageHeaders();
CALL CopyEntireMessage(); |
Then, use the latter procedure. |
|
Back to top |
|
 |
mq_crazy |
Posted: Wed Feb 02, 2005 11:14 am Post subject: |
|
|
 Master
Joined: 30 Jun 2004 Posts: 295
|
I changed as you said and now the message is not even going through the input node. Here is the new ESQL
CREATE COMPUTE MODULE TEST_FLOW_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
CALL CopyEntireMessage();
CALL TEST();
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= InputRoot;
END;
CREATE PROCEDURE TEST() BEGIN
SET OutputRoot.XML.Invoice.Firstname=UPPER(InputRoot.XML.Invoice.Firstname);
END;
END MODULE;
and the input message:
<Invoice><Firstname>rick</Firstname><Lastname>jen</Lastname><Contact>11111</contact></Invoice> |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Feb 02, 2005 11:20 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Again, use EITHER CopyEntireMessage OR CopyMessageHeaders BUT NOT both.
Also, how do you know that it is not getting past the input node? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
mq_crazy |
Posted: Wed Feb 02, 2005 11:28 am Post subject: |
|
|
 Master
Joined: 30 Jun 2004 Posts: 295
|
Thanks for the reply. I used only copyentiremessages function, but still it doesn't go through. I can check by looking at the input queue depth. Here is the new updated ESQL again..
CREATE COMPUTE MODULE TEST_FLOW_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
--CALL CopyMessageHeaders();
CALL CopyEntireMessage();
CALL TEST();
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= InputRoot;
END;
CREATE PROCEDURE TEST() BEGIN
SET OutputRoot.XML.Invoice.Firstname=UPPER(InputRoot.XML.Invoice.Firstname);
END;
END MODULE; |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Feb 02, 2005 11:52 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Okay, so you can tell that the message is not leaving the input queue.
Look at your system log, it should show you a message that tells you why it is not leaving the input queue. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
mq_crazy |
Posted: Wed Feb 02, 2005 12:04 pm Post subject: |
|
|
 Master
Joined: 30 Jun 2004 Posts: 295
|
I got it. It was my mistake, i checked the log and there it said it was problem with one of the tags in the XML message that i typed wrong. Anyway thanks everyone for all the replies.... |
|
Back to top |
|
 |
|