Author |
Message
|
ein |
Posted: Tue Apr 27, 2010 11:43 pm Post subject: Special character Problem in WMB |
|
|
Centurion
Joined: 14 Mar 2009 Posts: 108
|
Hello ALL,
I have problem with my exception handling.
In my exception handling flow i need to generate a messae in XML format with all info like exception time, exception type , Node name and flow name and so on and put it in MQ Q.
Coming my problem, In the Last xml tag the exception message flow has place the original content.
For example
<Exception>
<NODE></NODE>
<FLOW NAME></FLOWNAME>
<CONTENT> Orginal Message </CONTENT>
</Exception>
When I am placing the message in the CONTENT TAG I used the below code
SET OutputRoot.XMLNS.Exception.CONTENT = CAST(InputRoot.BLOB.BLOB AS CHAR CCSID InputRoot.MQMD.CharacterCodeSetID ENCODING InputRoot.MQMD.Encoding);
Some times the above statement is fails for some messages and went to BACK OUT Q.
But I want to avoid this situvation in exception handling.
Can any one suggest me , what universal CCSID and ENCODING I have to use here to avoid failing. |
|
Back to top |
|
 |
smdavies99 |
Posted: Tue Apr 27, 2010 11:53 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Why not read the message as a BLOB in the MQInput Node and before you parse it, copy it into the Environment. It is the BLOB domain already.
Something like
Code: |
MQInputNode-->ComputeNode-->TryCatch-->RCD etc
|
_________________ 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 |
|
 |
ein |
Posted: Wed Apr 28, 2010 12:10 am Post subject: |
|
|
Centurion
Joined: 14 Mar 2009 Posts: 108
|
I didn't clearly what you given, here i am provding what exactly i am doing.
Mqinput Node --->WTX NODE---> MqOutput Node
The catch terminal of the MQinput is connected to my Exception handling Flow.
The domain of the MQInput is BLOB. So when it comes to Exception handling flow the domain is also a blob.So I take it as BLOB and CASTING it TO CHAR. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Apr 28, 2010 1:19 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
In the Last xml tag the exception message flow has place the original content. |
What happens when the original content is not well-formed XML? |
|
Back to top |
|
 |
ein |
Posted: Wed Apr 28, 2010 2:55 am Post subject: |
|
|
Centurion
Joined: 14 Mar 2009 Posts: 108
|
Hi kimbert,
It say XML parsing error occured and went to BOQ. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Apr 28, 2010 5:30 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
It say XML parsing error occured and went to BOQ. |
Exactly. That's why it is normal to encode the faulty message in some way. The most common options are:
- CDATA (doesn't protect against bad characters, though )
- hexBinary encoding
- base64Binary encoding
CDATA has the advantage that the CDATA tags automatically get removed by any receiving XML parser. For hexBinary/base64Binary the receiving application will need to decode it ( not difficult ). |
|
Back to top |
|
 |
ein |
Posted: Wed Apr 28, 2010 10:56 pm Post subject: |
|
|
Centurion
Joined: 14 Mar 2009 Posts: 108
|
I tried to use base 64 encoding. Now it's passing the data to Q with encoded format.
Like
<Exception>
<FLowname> character</flowName>
<Content> BLOB[which is not understable by support team] </Content>
</Exception>
Then Contenet it showing hexa binary format. Which should not understable by support team. So next compute node I use base64 decode .so it reurns BLOB again.
Is ther any way to make it readble. |
|
Back to top |
|
 |
smdavies99 |
Posted: Thu Apr 29, 2010 12:15 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
You are caught in a bit of a Catch-22 situation here.
As I see it, if you use CDATA then messages with bad XML will not get parsed but the result is human readable.
So you use a BLOB and even bad XML messages will be sent out but the result is not human readable.
I've solved this before by using the Zipnode support pack. This results in a BLOB but the contents are human readable. The only drawback is the AFAIK, it does not work (toolkit) on V7 at the moment. _________________ 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 |
|
 |
ein |
Posted: Thu Apr 29, 2010 1:34 am Post subject: |
|
|
Centurion
Joined: 14 Mar 2009 Posts: 108
|
Without a zipnode can't we achive? |
|
Back to top |
|
 |
kimbert |
Posted: Thu Apr 29, 2010 5:30 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Then Contenet it showing hexa binary format. Which should not understable by support team. So next compute node I use base64 decode .so it reurns BLOB again. |
You could CAST the BLOB to CHARACTER ( using the correct CCSID). Of course, that will recreate the original badly-formed XML, so you'd better be sure not to send the resulting XML doc to an XML parser after the CAST. |
|
Back to top |
|
 |
ein |
Posted: Thu Apr 29, 2010 6:27 am Post subject: |
|
|
Centurion
Joined: 14 Mar 2009 Posts: 108
|
Hello All,
I could have reslove this issue by using base64 encoding and decoding with CDATA.
Now the message seems what i am expected.
Thanks every One |
|
Back to top |
|
 |
kimbert |
Posted: Thu Apr 29, 2010 8:02 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Would you mind explaining in a bit more detail? What exactly are you doing with the failure message now? |
|
Back to top |
|
 |
ein |
Posted: Fri Apr 30, 2010 12:44 am Post subject: |
|
|
Centurion
Joined: 14 Mar 2009 Posts: 108
|
First I am encdoing with base64
SET OutputRoot.XMLNS.Exception.Content = base64Encoding(InputRoot.BLOB.BLOB);
On SeconCompute Node I am decoding with Base64Decode and assigned this CDATA.
SET OutputRoot.XMLNS.Exception.Content.(XMLNSC.CDATA)Content=base64Decode(InputRoot.XMNS.Exception.Content);
Please let me know if you need more info |
|
Back to top |
|
 |
kimbert |
Posted: Fri Apr 30, 2010 1:16 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I may be missing the point here, but it looks as if you could achieve exactly the same result by encoding it as CDATA in the first Compute node.
If CDATA meets the requirements then don't bother with the redundant conversion to base64 and back again.
If you're concerned that the original message might contain bad characters then find a way to make the base64 readable *after* it has been sent to the support team. |
|
Back to top |
|
 |
ein |
Posted: Fri Apr 30, 2010 3:22 am Post subject: |
|
|
Centurion
Joined: 14 Mar 2009 Posts: 108
|
Hi Kimbert,
I tried usnig CDATA in first Compute Node. But its again failed sent to BOQ.
ITs say XML Parsing errors occured. |
|
Back to top |
|
 |
|