|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
MbElement, IN, INOUT, MbElement[] |
« View previous topic :: View next topic » |
Author |
Message
|
DanielSonFocus |
Posted: Thu Aug 18, 2005 3:02 pm Post subject: MbElement, IN, INOUT, MbElement[] |
|
|
 Apprentice
Joined: 05 Jun 2005 Posts: 35 Location: Louisville, Kentucky
|
Hi,
I can't find any samples or documention out there on how to take a reference to InputRoot make some changes to it in a Java Procedure and send back the modified OutputRoot. I can call the Java procedure with ESQL and that works fine. But when the message gets to the Output Node i get a "No valid message body" could be found. Im thinking the java call is taking InputRoot and not setting the OutputRoot.
Here's my call in ESQL:
Code: |
CREATE COMPUTE MODULE JavaSendMail_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
CALL CopyEntireMessage();
DECLARE resp CHAR Swap(InputRoot.XML, 'true', 'c:\smtpmail\logs\smtplog.log');
SET OutputRoot.XML.resp = resp;
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;
END MODULE;
-------------------------------------------------------------------------------
-- Swap
-------------------------------------------------------------------------------
CREATE PROCEDURE Swap(IN smtpMessage REFERENCE, IN debug CHAR, IN debugFile CHAR)
RETURNS CHARACTER
LANGUAGE JAVA
EXTERNAL NAME "Swapper.swap";
|
Here's my java code:
Code: |
public class Swapper
{
/*************************************************************************/
public static String send(MbElement message, String dbug, String debugFile)
{
//Logic for changing an element in inputRoot and returning Outputroot?
}
|
|
|
Back to top |
|
 |
DanielSonFocus |
Posted: Thu Aug 18, 2005 6:10 pm Post subject: |
|
|
 Apprentice
Joined: 05 Jun 2005 Posts: 35 Location: Louisville, Kentucky
|
I need something like this, but it doesn't work:
Code: |
CREATE COMPUTE MODULE JavaSendMail_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
CALL CopyEntireMessage();
DECLARE resp CHAR Swap(InputRoot.XML, OutputRoot.XML);
SET OutputRoot.XML.resp = resp;
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;
END MODULE;
-------------------------------------------------------------------------------
-- Swap
-------------------------------------------------------------------------------
CREATE PROCEDURE Swap(IN inputRoot REFERENCE, INOUT outputRoot REFERENCE)
RETURNS CHARACTER
LANGUAGE JAVA
EXTERNAL NAME "Swapper.swap";
|
Code: |
public class Swapper
{
/*************************************************************************/
public static String send(MbElement inputRoot, MbElement[] outputRoot)
{
outputRoot[0].copyElementTree(inputRoot);
}
}
|
|
|
Back to top |
|
 |
DanielSonFocus |
Posted: Mon Aug 22, 2005 9:22 am Post subject: |
|
|
 Apprentice
Joined: 05 Jun 2005 Posts: 35 Location: Louisville, Kentucky
|
|
Back to top |
|
 |
bower5932 |
Posted: Mon Aug 22, 2005 9:52 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
Have one of the moderators move this to the WMQI forum. You might have better luck. |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Aug 22, 2005 10:39 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
It might be that you aren't passing the right kinds of things to the procedure.
There were comments in the WMQI forum quite a while ago about passing in references to InputRoot and OutputRoot as well as LocalEnvironment and etc.
Also, you might be having some of the same kinds of issues that one has with a plugin where one needs to create a new assembly before one can update the trees. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|