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 » Converting XML file to a string using ESQL

Post new topic  Reply to topic
 Converting XML file to a string using ESQL « View previous topic :: View next topic » 
Author Message
malika
PostPosted: Wed Mar 24, 2010 4:27 am    Post subject: Converting XML file to a string using ESQL Reply with quote

Newbie

Joined: 08 Mar 2010
Posts: 6

Hi All,

I want to covert an XML file into a string using ESQL (compute node), but I dont know how I should set the message in string format in the output node.

I tried using Set OutputRoot = message;, where message is the variable defined in the module, but I m not getting the output.

I even tried Set OutputRoot.XML.data = message;, but this gives me the string with <data></data> tags.

Please let me know what should I use , so that I can get a plain string
Back to top
View user's profile Send private message
Gaya3
PostPosted: Wed Mar 24, 2010 5:05 am    Post subject: Reply with quote

Jedi

Joined: 12 Sep 2006
Posts: 2493
Location: Boston, US

The below topics have been discussed and debated a lot in this forum.
converting xml to string , string to xml , blob to xml ...goes on

nobody stops you in searching
_________________
Regards
Gayathri
-----------------------------------------------
Do Something Before you Die
Back to top
View user's profile Send private message
cc
PostPosted: Wed Mar 24, 2010 12:53 pm    Post subject: Convert ExceptionList to CHAR Reply with quote

Novice

Joined: 28 May 2008
Posts: 19

This may get you started:

Create LASTCHILD of OutputRoot DOMAIN('XML') Name 'XML';
SET OutputRoot.XML.ExceptionList = InputExceptionList;
DECLARE EXCEPTIONBLOB BLOB ASBITSTREAM(OutputRoot.XML.ExceptionList);
DECLARE FULLEXCEPTION CHAR
CAST(ASBITSTREAM(OutputRoot.XML.ExceptionList) AS CHAR CCSID InputRoot.MQMD.CodedCharSetId);
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Mar 24, 2010 12:57 pm    Post subject: Re: Convert ExceptionList to CHAR Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

cc wrote:
This may get you started:

Create LASTCHILD of OutputRoot DOMAIN('XML') Name 'XML';


This will get you started down the road to Hell. The XML domain should not be used for any reason. Use XMLNSC or (in extreme circumstances) XMLNS.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Mar 24, 2010 2:39 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Hi cc,

Welcome to the forum! Bad luck for stepping on a mine on your first attempt at helping.

For future reference, don't advise other people to use the deprecated XML domain, and make sure that any advice that you offer is in line with what the infocenter says. This forum is not just to provide quick answers - the aim is to spread good practices.
Back to top
View user's profile Send private message
malika
PostPosted: Thu Mar 25, 2010 5:20 am    Post subject: Converting XML file to a string using ESQL Reply with quote

Newbie

Joined: 08 Mar 2010
Posts: 6

Thanks for the replies....I tried setting the domain to XMLNS, by changing the property of the input node to XMLNS, but stiil getting probs.

As I m very new this, please help be on the below also.

Before that I wana tell u exactly wat I need.

I will get XML files in input node, using esql I need to fetch the fields of XMl , manipulate them and then in form of a single string pass to the output node, which will further hit some server


eg:
<request>
<id>12345</id>
<mode>abc</mode>
</request>

How I am implementing---I m fecthing the feilds of the XML file using the below code and assigning them to variable, which will be concatenated further to form a string

Set variable1 = InputRoot.XMLNS.request.id || '_ID';
Set Variable2 = ......
...

Set Final_string = variable1 || variable2 ........;

Set OutputRoot = Final_string;


But when I put a XML file thru test client in input node, I dont get any response in output node.

Please help me on this.

Thanks
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Mar 25, 2010 5:35 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Sounds like you need to read some of the introductory material about message broker. You have got some fairly serious gaps in your understanding.

Key points:
- Message flows work on the 'message tree' which is a logical representation of the message
- Parsers convert the bitstream to the message tree on the input side of the flow, and convert the other way on the output side of the flow.
- You can use a different parser for the input and output sides of your flow.
- Your message flow parses XML input, and writes non-XML output.

When you've digested that lot, you might like to post again - I suspect your question will have changed quite a lot.
Back to top
View user's profile Send private message
malika
PostPosted: Thu Mar 25, 2010 5:46 am    Post subject: Converting XML file to a string using ESQL Reply with quote

Newbie

Joined: 08 Mar 2010
Posts: 6

Thanks...u got that write,

I am very new to all this and didnot got time to go through the tutorials properly.

As this need to be done urgently, can you let me know how should I do that. My understanding is (correct me if I am wrong)
Input node property>input parser needs to be changed to XML and for output node I can set the property(thru code) to a non XML format. But wat that format should be, so that I can get a string form.


And please let me know whether my approach of assigning value to variable using below code is proper or not.

Set Variable1 = InputRoot.XMLNS.request.id

Thanks in advance
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Mar 25, 2010 6:11 am    Post subject: Re: Converting XML file to a string using ESQL Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

malika wrote:
I am very new to all this and didnot got time to go through the tutorials properly.


Then you should push back on whoever gave you the task. WMB is not a simple piece of software and you're going to struggle.

malika wrote:
As this need to be done urgently, can you let me know how should I do that.


There's no simple answer to "how do I do that". WMB is too complex for that.

malika wrote:
My understanding is (correct me if I am wrong)
Input node property>input parser needs to be changed to XML and for output node I can set the property(thru code) to a non XML format. But wat that format should be, so that I can get a string form.


Your understanding is wrong. Firstly, do not use the XML parser for any reason. Use XMLNSC or XMLNS. Secondly, as my assoicate points out WMB works on message trees, converting the message tree to a bitstream on output as it converts a bitstream to a tree on input. Hence you can't just write a string out by assigning it to OutputRoot; you need to build a message tree (in your case a fairly simple one) and use that to get a bitstream.


malika wrote:
please let me know whether my approach of assigning value to variable using below code is proper or not.

Set Variable1 = InputRoot.XMLNS.request.id


Use XMLNSC unless you have a really, really good reason not to.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
malika
PostPosted: Mon Mar 29, 2010 11:59 pm    Post subject: Converting XML file to a string using ESQL Reply with quote

Newbie

Joined: 08 Mar 2010
Posts: 6

Thanks for your replies...

I am now able to get a string in th output node using the below code in compute node.
SET OutputRoot.BLOB.BLOB=CAST (message AS BLOB CCSID 1208);
where message is a variable (declared as character), which has the concatenated data.
Back to top
View user's profile Send private message
Gaya3
PostPosted: Tue Mar 30, 2010 12:57 am    Post subject: Re: Converting XML file to a string using ESQL Reply with quote

Jedi

Joined: 12 Sep 2006
Posts: 2493
Location: Boston, US

malika wrote:
Thanks for your replies...

I am now able to get a string in th output node using the below code in compute node.
SET OutputRoot.BLOB.BLOB=CAST (message AS BLOB CCSID 1208);
where message is a variable (declared as character), which has the concatenated data.


you are learning...good to know...
_________________
Regards
Gayathri
-----------------------------------------------
Do Something Before you Die
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Converting XML file to a string using ESQL
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.