|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Message Flows |
« View previous topic :: View next topic » |
Author |
Message
|
tinglan |
Posted: Wed May 08, 2002 8:56 am Post subject: |
|
|
Newbie
Joined: 06 May 2002 Posts: 5
|
I have a requirement that a XML format message comes in (begins with <AddClaim>..) but the output message must be in the combination format of text and XML:
EA_ENVMGR=localhost:30001;EA_SERVICE=Claims01;EA_METHOD=AddClaim;
<?xml version="1.0" encoding="UTF-8" ?>
<AddClaim>
<InputPrompt>
<Claim>22SJ5555</Claim>
<DOL>10101</DOL>
<PolicyNo>0091000007</PolicyNo>
</InputPrompt>
</AddClaim>
So,I created 4 nodes in the MQSI Control Center message flows - Input Terminal, Compute, 2 Output Terminals (one for good results, one for errors).
I got output message in the good results Output Terminal only if the message was XML format (with tags). But if the message was in the mixed format (text plus XML), then the message goes to the error-output terminal. ESQL in the Compute node as follows:
DECLARE I INTEGER;
SET I = 1;
WHILE I < CARDINALITY(InputRoot.*[]) DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I=I+1;
END WHILE;
DECLARE jLocHost CHARACTER;
SET Jlochost =
'EA_ENVMGR=localhost:30001 EA_SERVICE=Claims01 EA_METHOD=AddClaim';
SET OutputRoot = jLocHost;
--Create an XML Declaration
SET OutputRoot.XML.(XML.XmlDecl)=’’;
--Set the Version within the XML Declaration
SET OutputRoot.XML.(XML.XmlDecl).(XML.Version)=’1.0 ’;
--Set the Encoding within the XML Declaration
SET OutputRoot.XML.(XML.XmlDecl).(XML."Encoding")=’UTF-8 ’;
SET OutputRoot.XML.AddClaim.InputPrompt.Claim = InputRoot.XML.Message.Claim.ClaimNo;
SET OutputRoot.XML.AddClaim.InputPrompt.DOL = InputRoot.XML.Message.Claim.DateOfLoss;
SET OutputRoot.XML.AddClaim.InputPrompt.PolicyNo = InputRoot.XML.Message.Claim.Policy;
Please give me some pointers for the resolutions!!
Thanks,
Tina |
|
Back to top |
|
 |
kirani |
Posted: Wed May 08, 2002 1:20 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
This is how you can do it,
1. Parse your input message as XML in MQInput node.
2. In first compute node create output message (XML part only). So you ESQL stays there only remove 'EA_ENVMGR ......' part.
3. Parse this message as BLOB using RCD.
4. In second compute node, add 'EA_ENVMGR ...' data in BLOB format to your incoming XML message. Your input XML message can be refered as InputRoot."BLOB"."BLOB" in compute node. Set MQMD.Format to MQSTR.
Let me know if it is not clear.
_________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
tinglan |
Posted: Wed May 08, 2002 2:44 pm Post subject: |
|
|
Newbie
Joined: 06 May 2002 Posts: 5
|
Hi Kiran,
I attempted to follow your instructions but got stuck on the #4. Can you show me how the coding would be in the 2nd Compute node? Also in the #3, did you mean RCD was ResetContentDescriptor node?
Here is the ESQL in the 2nd Compute node:
DECLARE I INTEGER;
SET I = 1;
WHILE I < CARDINALITY(InputRoot.*[]) DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I=I+1;
END WHILE;
-- Enter SQL below this line. SQL above this line might be regenerated, causing any modifications to be lost.
DECLARE jacadaMessage BLOB;
SET jacadaMessage = CAST ('EA_ENVMGR=localhost:30001 EA_SERVICE=Claims01 EA_METHOD=AddClaim;' AS BLOB);
SET OutputRoot."BLOB" = jacadaMessage;
SET OutputRoot."BLOB"."BLOB" = InputRoot."BLOB"."BLOB";
SET OutputRoot.MQMD.Format = 'MQSTR';
Thank you so much. |
|
Back to top |
|
 |
kirani |
Posted: Thu May 09, 2002 8:08 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Hi,
Yes, by RCD I mean ResetContentDescriptor node.
This is not the best way to do it, but I am sure this works.
Following ESQL goes into your second compute node,
DECLARE I INTEGER;
SET I = 1;
WHILE I < CARDINALITY(InputRoot.*[]) DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I=I+1;
END WHILE;
-- Enter SQL below this line. SQL above this line might be regenerated, causing any modifications to be
lost.
DECLARE jacadaMessage BLOB;
-- Enter BLOB of your Text message
SET javacaMessage = X'45415F454E564D47523D6C6F63616C686F73743A33303030312045415F534552564943453D436C61696D7330312045415F4D4554484F443D416464436C61696D3B';
-- Append your input XML message converted to BLOB to your Text message.
SET OutputRoot."BLOB"."BLOB" = jacadaMessage || InputRoot."BLOB"."BLOB";
There is a problem in casting your Text message to BLOB, so I am using BLOB representation of your text message. Where is your broker located?
One other way to handle these kind of messages is to define them in NEON.
_________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
tinglan |
Posted: Thu May 09, 2002 10:49 am Post subject: |
|
|
Newbie
Joined: 06 May 2002 Posts: 5
|
Kiran,
Thank you so much for your help. Your code works like a champ and I got the correct formatted output message now. For the code translation (ASCII to HEX), do you have a tool to do that? Because I might need to generate more messages similar to this one. My broker is sitting on a NT box.
Thanks again,
Tina |
|
Back to top |
|
 |
kirani |
Posted: Thu May 09, 2002 12:07 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Great!
The best way to get HEX codes for ASCII text is to put that text as a message on some queue and then use MQSeries Explorer to get hex values! It is just copy paste operation and some minor editing. Add these hex values within X'.....'. This gives you message text in BLOB format.
_________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
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
|
|
|
|