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 » esql problem

Post new topic  Reply to topic
 esql problem « View previous topic :: View next topic » 
Author Message
mq_crazy
PostPosted: Tue Feb 22, 2005 2:01 pm    Post subject: esql problem Reply with quote

Master

Joined: 30 Jun 2004
Posts: 295

I am trying to attach xml header to a message in the compute node, but the output doesn't comeout with the headers. Here is the ESQL used in the node:

CREATE COMPUTE MODULE NYPD_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.(XML.XmlDecl).(XML.Version) = '1.0';
SET OutputRoot.XML.(XML.XmlDecl).(XML."Encoding") ='UTF-8';
SET OutputRoot.XML.(XML.XmlDecl).(XML.Standalone)='no';
SET OutputRoot=InputRoot;

END;
END MODULE;


Am i doing anything wrong??
Back to top
View user's profile Send private message
sieijish
PostPosted: Tue Feb 22, 2005 2:09 pm    Post subject: Reply with quote

Acolyte

Joined: 29 Nov 2004
Posts: 67
Location: London

What headers are you expecting?

why are you doing
Quote:

SET OutputRoot=InputRoot;

in CopyEntireMessage()
Back to top
View user's profile Send private message
Michael Dag
PostPosted: Tue Feb 22, 2005 2:10 pm    Post subject: Reply with quote

Jedi Knight

Joined: 13 Jun 2002
Posts: 2607
Location: The Netherlands (Amsterdam)

Try:
SET OutputRoot=InputRoot;
SET OutputRoot.XML.(XML.XmlDecl).(XML.Version) = '1.0';
SET OutputRoot.XML.(XML.XmlDecl).(XML."Encoding") ='UTF-8';
SET OutputRoot.XML.(XML.XmlDecl).(XML.Standalone)='no';


_________________
Michael



MQSystems Facebook page
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
jefflowrey
PostPosted: Tue Feb 22, 2005 2:17 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Why are you calling both CopyMessageHeaders and CopyEntireMessage?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
mq_crazy
PostPosted: Wed Feb 23, 2005 7:58 am    Post subject: Reply with quote

Master

Joined: 30 Jun 2004
Posts: 295

This is my situation. I have mqinput node where i gave my messageset info. Domain as MRM, format as CWF1. My messageset has two formats CWF1 and XML1. I changed the message properties in compute node to change it to XML. The message comes out fine as XML. Now i need to attach a xml header, if i add that in compute node it gives error.

Please help. Here is my ESQL code..

CREATE COMPUTE MODULE IntegratedJustice_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=InputRoot;
SET OutputRoot.Properties.MessageFormat ='XML1';
SET OutputRoot.XML.(XML.XmlDecl).(XML.Version)='1.0';


END;
END MODULE;
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Feb 23, 2005 8:03 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

jefflowrey wrote:
Why are you calling both CopyMessageHeaders and CopyEntireMessage?

_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
mq_crazy
PostPosted: Wed Feb 23, 2005 8:06 am    Post subject: Reply with quote

Master

Joined: 30 Jun 2004
Posts: 295

shud i not copy both?? my intention is to copy whole message exactly and attach this extra header.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Feb 23, 2005 8:11 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

If you wish to add stuff to the front of the message, but after the headers, then you should only copy the headers, then add your new stuff, and then copy the rest of the input body.

This is basic use of the product and ESQL. ESQL constructs the output tree in the order that was specified.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
mq_crazy
PostPosted: Wed Feb 23, 2005 8:25 am    Post subject: Reply with quote

Master

Joined: 30 Jun 2004
Posts: 295

Thanks jeff for replying. Can you tell me how shud my ESQL code look like???
Back to top
View user's profile Send private message
javaforvivek
PostPosted: Fri Feb 25, 2005 7:24 am    Post subject: Reply with quote

Master

Joined: 14 Jun 2002
Posts: 282
Location: Pune,India

mq_dude wrote:
Quote:
shud i not copy both?? my intention is to copy whole message exactly and attach this extra header.


Inserting the xml declaration is not same as inserting extra information in header.

Structure of any MQ Message is like this: MQ Message Discriptor (MQMD) + Optional RFH2 Header + Application data

Now if your Input Message is in XML domain but without the XML Declaration (<?xml version="1.0"?>), then you need to add this line in the application data and not in the MQMD..
So you can just call CopyEntireMessage and then write the code given by
MichaelDag.
I myself don't have access to WBIMB (I'm assuming that you are using WBIMB) right now, but I hope that the code will work well for you.
_________________
Vivek
------------------------------------------------------
...when you have eliminated the impossible, whatever remains, however improbable, must be the truth.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
jwende
PostPosted: Tue Mar 01, 2005 2:19 pm    Post subject: Reply with quote

Novice

Joined: 02 Jul 2001
Posts: 23

if your messageset has both renderings (CWF and XML), the output XML format will be written by the MRM XML writer component - I think this component doesn't care anything about your settings like
SET OutputRoot.XML = xyz;
it still ignores this as additional message tree information (because they are not defined in your message set).
You may consider changing the XML1 properties of your messageset to include some sort of XML header information.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

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