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 » Cast Exception when trying to convert BLOB into CHARACTER

Post new topic  Reply to topic
 Cast Exception when trying to convert BLOB into CHARACTER « View previous topic :: View next topic » 
Author Message
cong_ren
PostPosted: Wed Jan 25, 2012 3:07 pm    Post subject: Cast Exception when trying to convert BLOB into CHARACTER Reply with quote

Newbie

Joined: 25 Jan 2012
Posts: 2

Hi,

I am getting the following cast exception when trying to convert a BLOB into a CHARACTER. It is unable to convert some of the characters inside the BLOB to the CHARACTER type.

Here is the ESQL code snippet of the casting operation:
SET OutputRoot.JMSTransport.Transport_Folders.Header_Values.JMSCorrelationID = CAST(InputLocalEnvironment.Destination.SOAP.Reply.ReplyIdentifier AS CHARACTER CCSID InputRoot.Properties.CodedCharSetId);

Question:
1. Is there anything wrong with the casting statement above?
2. If so, any recommendations as to how can I resolve this issue?

The reason I am doing such casting is to propagate the SOAPReplyID from the request flow to the response flow using the JMSCorrelID as a delivery vehicle.

Request: SOAP -> JMS
Response: JMS -> SOAP


+===============
Details of the Exception
+===============

ExceptionList
RecoverableException
File:CHARACTER:F:\build\S700_P\src\DataFlowEngine\ImbDataFlowNode.c
pp
Line:INTEGER:1073
Function:CHARACTER:ImbDataFlowNode::createExceptionList
Type:CHARACTER:ComIbmComputeNode
Name:CHARACTER:OrderServices#FCMComposite_1_24
Label:CHARACTER:OrderServices.SetSOAPReplyIdToJMSCorrelId
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:2230
Text:CHARACTER:Node throwing exception
RecoverableException
File:CHARACTER:F:\build\S700_P\src\DataFlowEngine\ImbRdl\ImbRdlSt
atementGroup.cpp
Line:INTEGER:641
Function:CHARACTER:SqlStatementGroup::execute
Type:CHARACTER:ComIbmComputeNode
Name:CHARACTER:OrderServices#FCMComposite_1_24
Label:CHARACTER:OrderServices.SetSOAPReplyIdToJMSCorrelId
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:2488
Text:CHARACTER:Error detected, rethrowing
Insert
Type:INTEGER:5
Text:CHARACTER:.SSFSAPIsUtil_SetSOAPReplyIdToJMSCorrelId.Main
Insert
Type:INTEGER:5
Text:CHARACTER:4.3
Insert
Type:INTEGER:5
Text:CHARACTER:SET
OutputRoot.JMSTransport.Transport_Folders.Header_Values.JMSCorrelation
ID = CAST(InputLocalEnvironment.Destination.SOAP.Reply.ReplyIdentifier
AS CHARACTER CCSID InputRoot.Properties.CodedCharSetId);
RecoverableException
File:CHARACTER:F:\build\S700_P\src\DataFlowEngine\ImbRdl\ImbRdl
TypeCast.cpp
Line:INTEGER:260
Function:CHARACTER:SqlTypeCast::evaluate
Type:CHARACTER:
Name:CHARACTER:
Label:CHARACTER:
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:2521
Text:CHARACTER:Error while casting
Insert
Type:INTEGER:5
Text:CHARACTER:.SSFSAPIsUtil_SetSOAPReplyIdToJMSCorrelId.Main
Insert
Type:INTEGER:5
Text:CHARACTER:4.82
Insert
Type:INTEGER:5
Text:CHARACTER:X'534f4150000000000c000000000000008c1600000000
0000'
Insert
Type:INTEGER:5
Text:CHARACTER:CHARACTER
RecoverableException
File:CHARACTER:F:\build\S700_P\src\CommonServices\ImbConverte
r.cpp
Line:INTEGER:504
Function:CHARACTER:ImbConverterCPP::internalToUnicode
Type:CHARACTER:
Name:CHARACTER:
Label:CHARACTER:
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:2135
Text:CHARACTER:Unconvertable character
Insert
Type:INTEGER:5
Text:CHARACTER:8c
Insert
Type:INTEGER:5
Text:CHARACTER:534f4150000000000c000000000000008c1600000000
0000
Insert
Type:INTEGER:2
Text:CHARACTER:1208


Back to top
View user's profile Send private message
rekarm01
PostPosted: Wed Jan 25, 2012 5:03 pm    Post subject: Re: Cast Exception when trying to convert BLOB into CHARACTE Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

This BLOB is not a valid UTF-8 byte sequence, because the byte X'8c' is not a valid UTF-8 start byte:
Quote:
X'53 4f 41 50 00 00 00 00 0c 00 00 00 00 00 00 00 8c 16 00 00 00 00 00 00'

Not every random byte sequence can represent a meaningful character string, (particularly those meant to represent correlation identifiers). Perhaps it's better to leave it in HEX when CASTing to CHARACTER, by removing the CCSID parameter:

Code:
SET OutputRoot.JMSTransport.Transport_Folders.Header_Values.JMSCorrelationID
    = CAST(InputLocalEnvironment.Destination.SOAP.Reply.ReplyIdentifier AS CHARACTER);
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Jan 25, 2012 9:06 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Have you even verified if the byte sizes are compatible?

A BLOB cannot always be CASTed to a CHAR. How do you transform x'00000000' into a char, in any CCSID?

Think it over again. The design may not fit.
Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Thu Jan 26, 2012 4:54 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
This BLOB is not a valid UTF-8 byte sequence, because the byte X'8c' is not a valid UTF-8 start byte:
rekarm01 is correct. You should never have tried to cast the bytes of the MQMD header as characters. The MQMD contains a mixture of character and binary ( non-character ) data.
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Thu Jan 26, 2012 5:50 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

If your trying to print the MQMD.MsgId or MQMD.CorrelationId, here is some snazzy code to do the same from a JCN...

Code:
      for( int i = 0; i < 24; i++ ){
               
        String iHexStr = Integer.toHexString( Id[i] );
        if ( iHexStr.length()>2 ) iHexStr = iHexStr.substring( iHexStr.length()-2 );
        if ( iHexStr.length()<2 ) refId = refId + "0";
        refId = refId + iHexStr;     
               
      }


Good luck.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
cong_ren
PostPosted: Fri Jan 27, 2012 9:08 am    Post subject: Thanks for all your replies. But just wondering... Reply with quote

Newbie

Joined: 25 Jan 2012
Posts: 2

Thank you all who responded! Greatly appreciated.

I spent some of my time yesterday looking at the issue and tried 2 following attempts, both of which seems to resolve that casting issue:

1. Remove the CCSID parameter from the casting statement as recommended by rekarm01 and simply leave it as a HEX.

2. Changed the default windows codepage from 437 to 65001 and without changing the CCSID parameter.

I am still relatively new to MB and the code page. I sort of understand that BLOB is not a valid CHARACTER string and there can be sequences of strings within which cannot be converted to a CHARACTER (such as 'c8'). But I don't understand why what I did above seems to resolve the issue.

For #1, by removing the CCSID parameter, what does MB use instead for the casting? The default OS code page or the incoming message code page? Or neither?

For #2, it seems like MB takes the default OS code page into consideration. But how and when?
Back to top
View user's profile Send private message
kimbert
PostPosted: Fri Jan 27, 2012 9:21 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
For #1, by removing the CCSID parameter, what does MB use instead for the casting? The default OS code page or the incoming message code page? Or neither?
see http://publib.boulder.ibm.com/infocenter/wmbhelp/v7r0m0/topic/com.ibm.etools.mft.doc/ak05680_.htm
Specifically, the row which explains BLOB to CHARACTER casts. By removing the CCSID clause you revert to the behaviour in the first paragraph ( the BLOB is not interpreted as CHARACTER data, it gets converted to a hexBinary string ).
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 » Cast Exception when trying to convert BLOB into CHARACTER
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.