Author |
Message
|
LibroMax |
Posted: Mon Feb 15, 2016 5:24 am Post subject: Parse String to XMLNSC structure |
|
|
Newbie
Joined: 25 Oct 2015 Posts: 5
|
Hello
First I already searched too much about this case but nothing help
I need to convert XML message with namesapce that came from Global cache and put it into my XMLNSC tree by using ESQL only
my steps was get the value from global cache as String
Convert it into BLOB
Convert again it to XMLNSC
My code:
DECLARE receiveRQ CHARACTER;
SET receiveRQ = manageGlobalCache(GCKey,null,'inquiry');
SET myMessage = CAST(receiveRQ AS BLOB CCSID 1208);
DECLARE inCCSID INT InputProperties.CodedCharSetId;
DECLARE inEncoding INT InputProperties.Encoding;
CREATE LASTCHILD OF OutputRoot DOMAIN('XMLNSC') PARSE(myMessage,inCCSID ,inEncoding ,'BLOB', 'XMLNSC');
manageGlobalCache: is internal fuction that receive the global cache
The problem was in the parse line:
CREATE LASTCHILD OF OutputRoot DOMAIN('XMLNSC') PARSE(myMessage,inCCSID ,inEncoding ,'BLOB', 'XMLNSC');
this part return an error in parsing
Could you please help me because I don't know what the error on this statement
And If anyone have another manner to parse the cached message(XML as String) into XMLNSC structure in one step that will be so welcomed
Thanks in advance |
|
Back to top |
|
 |
maurito |
Posted: Mon Feb 15, 2016 5:40 am Post subject: Re: Parse String to XMLNSC structure |
|
|
Partisan
Joined: 17 Apr 2014 Posts: 358
|
LibroMax wrote: |
Hello
First I already searched too much about this case but nothing help
I need to convert XML message with namesapce that came from Global cache and put it into my XMLNSC tree by using ESQL only
my steps was get the value from global cache as String
Convert it into BLOB
Convert again it to XMLNSC
My code:
DECLARE receiveRQ CHARACTER;
SET receiveRQ = manageGlobalCache(GCKey,null,'inquiry');
SET myMessage = CAST(receiveRQ AS BLOB CCSID 1208);
DECLARE inCCSID INT InputProperties.CodedCharSetId;
DECLARE inEncoding INT InputProperties.Encoding;
CREATE LASTCHILD OF OutputRoot DOMAIN('XMLNSC') PARSE(myMessage,inCCSID ,inEncoding ,'BLOB', 'XMLNSC');
manageGlobalCache: is internal fuction that receive the global cache
The problem was in the parse line:
CREATE LASTCHILD OF OutputRoot DOMAIN('XMLNSC') PARSE(myMessage,inCCSID ,inEncoding ,'BLOB', 'XMLNSC');
this part return an error in parsing
Could you please help me because I don't know what the error on this statement
And If anyone have another manner to parse the cached message(XML as String) into XMLNSC structure in one step that will be so welcomed
Thanks in advance |
Code: |
|--PARSE--(--BitStreamExpression--+------------------------------+--)--|
| .-<<-----------------------. |
| V | |
'---+-ENCODING--expression-+-+-'
+-CCSID--expression----+
+-SET--expression------+
+-TYPE--expression-----+
+-FORMAT--expression---+
'-Options--------------'
|
http://www-01.ibm.com/support/knowledgecenter/SSMKHH_9.0.0/com.ibm.etools.mft.doc/ak04950_.htm?lang=en
It would help us if you told us what error you are getting. 'BLOB' and 'XMLNSC' in the PARSE clause do not seem to be correct.
You should try something like
Code: |
PARSE (myMessage ENCODING xxxx CCSID yyyyy OPTIONS RootBitStream);
|
|
|
Back to top |
|
 |
LibroMax |
Posted: Mon Feb 15, 2016 5:47 am Post subject: |
|
|
Newbie
Joined: 25 Oct 2015 Posts: 5
|
Thanks for your reply
when I depug on this code I got:
CHARACTER:XML Parsing Errors have occurred
on this statement:
CREATE LASTCHILD OF OutputRoot DOMAIN('XMLNSC') PARSE(myMessage,inCCSID ,inEncoding ,'BLOB', 'XMLNSC'); |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Feb 15, 2016 5:52 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Why are you using inCCSID when your BLOB is in CCSID 1208 ?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
timber |
Posted: Mon Feb 15, 2016 6:29 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
Quote: |
when I depug on this code I got:
CHARACTER:XML Parsing Errors have occurred |
Please listen carefully...this will save you ( and probably us ) a lot of time.
The error that you have quoted is useless. It tells you nothing at all about how to fix the problem. Whenever you see a useless error message from IIB, assume that there is a more useful error message available.
There is an excellent DeveloperWorks article with the title 'Diagnostic tools available in WebSphere Message Broker and IBM Integration Bus'.
Or, you may be able to reach this blog post by the author:
https://developer.ibm.com/integration/docs/ibm-integration-bus/troubleshooting/diagnostic-tools/
In your case, the short answer is 'take a user trace'. |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Feb 15, 2016 8:10 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
timber wrote: |
In your case, the short answer is 'take a user trace'. |
Ahh... the dying art of usertrace. Apparently is it no longer part of the standard training.
I mentioned this to a fairly new developer recenrly. He looked at me as if I was talking gibberish.
Shame really. It is such a powerful weapon in the developer toolbox. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
timber |
Posted: Tue Feb 16, 2016 7:32 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
In this case, user trace is not the only way to get the desired result ( as smdavies99 knows ). It just happens to be the way that experienced developers would do it.
The exceptionList tree always contains the full list of exceptions, so the OP has all the information available right there in the debugger. They just need to look more closely. |
|
Back to top |
|
 |
smdavies99 |
Posted: Tue Feb 16, 2016 10:45 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
timber wrote: |
In this case, user trace is not the only way to get the desired result ( as smdavies99 knows ). It just happens to be the way that experienced developers would do it.
The exceptionList tree always contains the full list of exceptions, so the OP has all the information available right there in the debugger. They just need to look more closely. |
Very true but (there is always one), using the debugger rather than usertrace does not allow you to go backwards through your flow to see where (and the reasons why) it went wrong in the first place. It is very easy to search a usertrace for things like references that can't be resolved because the reference point does not exist. If you code 'defensively' then you can handle this in the ESQL.
Defensive programming is another lost art (IMHO). I was taught it during my degree 40+ years ago. Mention it today and you get blank stares. "What do you mean 'error handling'. My code does not have errors." Well your code might not have errors but GIGO is alive and kicking today.
but I'm getting off topc (by a million miles) so I'll shut up and drink some more
before starting another day some really badly designed software. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
LibroMax |
Posted: Wed Feb 17, 2016 1:22 am Post subject: |
|
|
Newbie
Joined: 25 Oct 2015 Posts: 5
|
Thanks everyone
I will consider the diagnostic tools for any new problem
The solution for my problem was:
I removed the the arguments for Encoding and CodedCharSetId
It's now working
DECLARE myMessage BLOB;
SET myMessage = CAST(receiveRS AS BLOB CCSID 1208);
CREATE LASTCHILD OF OutputRoot DOMAIN('XMLNSC') PARSE(myMessage); |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Feb 17, 2016 5:08 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
LibroMax wrote: |
Thanks everyone
I will consider the diagnostic tools for any new problem
The solution for my problem was:
I removed the the arguments for Encoding and CodedCharSetId
It's now working
DECLARE myMessage BLOB;
SET myMessage = CAST(receiveRS AS BLOB CCSID 1208);
CREATE LASTCHILD OF OutputRoot DOMAIN('XMLNSC') PARSE(myMessage); |
You should have kept the CCSID but instead of setting it to the value you had used first, set it to 1208 which is what represents the data, as described by your lines of code above...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|