Author |
Message
|
venky |
Posted: Mon Aug 15, 2005 7:37 am Post subject: Parsing XML/Flat File. |
|
|
 Master
Joined: 08 Jul 2003 Posts: 205
|
Hello All,
Here is my issue scenario:
The input is a XML message, one of the tags in the XML message contains the Flat File Data ( SNF 856 ).
The Output message sent to the target should be only the Flat File data extracted from input message and sent to Output queue.
Please let me know if this is possible. Any code examples will be great. I tried, but was unsuccessful.
Thanks in advance,
Venky
-- |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Aug 15, 2005 7:55 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
This is extremely basic use of the product. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
JT |
Posted: Mon Aug 15, 2005 9:16 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
|
Back to top |
|
 |
venky |
Posted: Mon Aug 15, 2005 6:05 pm Post subject: |
|
|
 Master
Joined: 08 Jul 2003 Posts: 205
|
JT,
Here is my ESQL.
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
--CALL CopyMessageHeaders();
CALL CopyEntireMessage();
SET OutputRoot.XML = NULL;
SET OutputRoot."BLOB"."BLOB" = BITSTREAM(InputRoot.XML.CustomerMsg.DataArea.MsgData);
RETURN TRUE;
END;
Thanks,
Venky
-- |
|
Back to top |
|
 |
EddieA |
Posted: Mon Aug 15, 2005 6:46 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Quote: |
CALL CopyEntireMessage(); |
Why are you copying the complete message if you are going to create a new message body.
This is deprecated. Look into using ASBITSTREAM.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
javaforvivek |
Posted: Wed Aug 17, 2005 2:55 am Post subject: |
|
|
 Master
Joined: 14 Jun 2002 Posts: 282 Location: Pune,India
|
Your code should be something like this:
Code: |
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
--CALL CopyEntireMessage();
SET OutputRoot.XML = NULL;
SET OutputRoot."BLOB"."BLOB" = ASBITSTREAM(InputRoot.XML.CustomerMsg.DataArea.MsgData);
RETURN TRUE;
END;
|
I dont have toolkit right now with me, so couldn't test the code...
but dig the esql pdf for more info on ASBITSTREAM function. _________________ Vivek
------------------------------------------------------
...when you have eliminated the impossible, whatever remains, however improbable, must be the truth. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Aug 17, 2005 3:19 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Actually, ASBITSTREAM is only necessary if venky needs to take a subtree from the input message as a single blob entity.
venky wrote: |
The input is a XML message, one of the tags in the XML message contains the Flat File Data ( SNF 856 ). |
This sounds like the VALUE of some tag contains the ENTIRE flatfile - so ASBITSTREAM is not necessary, and will do something wrong. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
javaforvivek |
Posted: Wed Aug 17, 2005 3:43 am Post subject: |
|
|
 Master
Joined: 14 Jun 2002 Posts: 282 Location: Pune,India
|
So do you mean to say that:
Either he can just copy the value of that field from InputRoot to OutputRoot:
Code: |
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
--CALL CopyEntireMessage();
CREATE FIELD OutputRoot.XML.Data VALUE InputRoot.XML.CustomerMsg.DataArea.MsgData;
RETURN TRUE;
END; |
Or if he wants the output message to be blob, he can use:
Code: |
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
--CALL CopyEntireMessage();
CREATE FIELD OutputRoot.BLOB.BLOB VALUE ASBITSTREAM(InputRoot.XML.CustomerMsg.DataArea.MsgData);
RETURN TRUE;
END; |
Or he can use first code in the list and then use RCD to convert it to BLOB..!! _________________ Vivek
------------------------------------------------------
...when you have eliminated the impossible, whatever remains, however improbable, must be the truth. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Aug 17, 2005 3:47 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Yeah, except I'd use SET instead of CREATE field - not for any good reason, just from habit.
Again, though, this is the most basic use of the product there is. This is lesson 1 on day 1 of any message flow training - "How do I make a different message out of the input message?". Some of the IBM classes will start with stuff like "This is the toolbox, this is a message flow, this is how you connect nodes...". _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
javaforvivek |
Posted: Wed Aug 17, 2005 3:51 am Post subject: |
|
|
 Master
Joined: 14 Jun 2002 Posts: 282 Location: Pune,India
|
I agree with jefflowry..
really, this is THE BASIC use of message broker... _________________ Vivek
------------------------------------------------------
...when you have eliminated the impossible, whatever remains, however improbable, must be the truth. |
|
Back to top |
|
 |
|