Author |
Message
|
sretsea_12 |
Posted: Sat Dec 17, 2011 3:26 am Post subject: Invalid character error while reading a message from Q |
|
|
Newbie
Joined: 17 Dec 2011 Posts: 8
|
Hi There,
Am using xms.net api for consuming a message from a queue and getting the following error
Description= ' ', hexadecimal value 0x06, is an invalid character.
Line 1, position 351.
or
Description= ' ', hexadecimal value 0x06, is an invalid character.
Line 1, position 381.
Environment details
MQ Server : 6.0
MQ Client : 7.0.1.3
can any one help me out |
|
Back to top |
|
 |
Vitor |
Posted: Sat Dec 17, 2011 5:12 am Post subject: Re: Invalid character error while reading a message from Q |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
sretsea_12 wrote: |
can any one help me out |
Yes. The message has a Hex 06 character in it and:
a) You've told WMQ to perform a conversion from the message code page into the native code page and that value doesn't map
b) Whatever your interpreting the message with doesn't like non-printable characters.
I favour b as an explaination but as you've posted nothing about the code pages in use, the circumstances of the error or even any proof that this is an error from WMQ rather than the .NET it could just as well be caused by a shortage of pixie dust in your server. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Dec 17, 2011 1:42 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
We need the ccsid of the message as described in RFHUtil(c) when browsed without the convert flag, the ccsid of the connection factory, and what usage your are putting the message to...
You might also want to upgrade to 7.0.1.6 and see if the error is still present.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
sretsea_12 |
Posted: Sun Dec 18, 2011 8:56 pm Post subject: |
|
|
Newbie
Joined: 17 Dec 2011 Posts: 8
|
Thanks for the reply
1)
using the below sample code to consume
Dim objXMSFactory As XMSFactoryFactory = Nothing
Dim objConFactory As IConnectionFactory = Nothing
Dim objQueue As IDestination = Nothing
Dim objConsumer As IMessageConsumer = Nothing
Dim objMsg As IMessage = Nothing
Dim objTxtMsg As ITextMessage = Nothing
Dim _objconn As IConnection
Dim _objSess As ISession
'Create the connection factories factory
objXMSFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ)
'Use the connection factories factory to create a connection factory
objConFactory = objXMSFactory.CreateConnectionFactory
objConFactory.SetStringProperty(XMSC.WMQ_HOST_NAME, txtServerName.Text.Trim)
objConFactory.SetIntProperty(XMSC.WMQ_PORT, txtPort.Text.Trim)
objConFactory.SetStringProperty(XMSC.WMQ_CHANNEL, txtMsgChannel.Text.Trim)
'WMQ_CONNECTION_MODE - Mode of APIs to connect Client,Bindings and UnManaged
objConFactory.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT)
objConFactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, txtQueueMgr.Text.Trim)
_objconn = objConFactory.CreateConnection
_objSess = _objconn.CreateSession(False, AcknowledgeMode.AutoAcknowledge)
objQueue = _objSess.CreateQueue(txtReqQueue.Text.Trim)
_objconn.Start()
objConsumer = _objSess.CreateConsumer(objQueue)
objMsg = objConsumer.Receive(txtInterval.Text.Trim * 1000) ' Set the time interval
If objMsg IsNot Nothing Then
objTxtMsg = objMsg
Else
Exit Try
End If
tOPText = objTxtMsg.Text
_objconn.Stop()
_objSess.Close()
_objSess.Dispose()
_objconn.Close()
_objconn.Dispose()
2)
details of the message to be recieved
Code character set identifier : 819
Encoding : 273
Format : MQRFH2
Message data :RFH
Type : Datagram
Please correct me if am wrong
XMS.net itself manages about the conversion we need not explicitly set the ccid
tried using latest version 7_7.0.1.7 but still the issue persists
3) Source of error : IBM.XMS.Client.Impl
and when i googled it about the error it says a invalid character is coming up in the message(XML string) and it is from the xml point of view.
when we highlighted this to producer of the message ,the team say same is consumed by their JAVA APIs and is working fine
How do i manage now? |
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Dec 18, 2011 9:59 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Set the CCSID property on the connection factory before creating the connection. Set the value to 1208 (UTF-8 ). Hope this will fix it.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
sretsea_12 |
Posted: Mon Dec 19, 2011 3:41 am Post subject: |
|
|
Newbie
Joined: 17 Dec 2011 Posts: 8
|
still the same
got some info on the message
RFH
MQSTR
<mcd><Msd>xmlns</Msd></mcd>
<jms><Rto>queue://QM2/RPI?persistence=1</Rto>
<Dst>queue:///PBI</Dst>
<Tms>1323924269140</Tms>
<Pri>8</Pri><Dlv>2</Dlv>
</jms>
*****
<usr><eventObject>Person</eventObject>
<objectTime>20111215101424</objectTime><eventId dt="i8">238913842</eventId>
<eventVerb>created</eventVerb><objectName>Person</objectName>
<ESB_StartTime>1323924269163</ESB_StartTime><CorrelationId>AMQ QM2 NÃ Ã I Â
</CorrelationId><Adapter_StartTime>1323924269188</Adapter_StartTime></usr>
L<psc><Topic>party/create/PartyPerson</Topic><Command>Publish</Command></psc>
****
<XML String>
Was able to read the message if the text additional text enclosed with in ** which is getting appended is not available
Actually information is processed through different system and the same is appended while processing it. |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Dec 19, 2011 5:45 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Quote: |
<CorrelationId>AMQ QM2 NÃ Ã I Â
</CorrelationId> |
This looks very suspicious. It looks like a byte array was treated as text and that is never a good thing... It may well violate XML well formed documents...
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
sretsea_12 |
Posted: Mon Dec 19, 2011 9:25 am Post subject: |
|
|
Newbie
Joined: 17 Dec 2011 Posts: 8
|
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Dec 19, 2011 10:51 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
sretsea_12 wrote: |
what to do then? |
Have the sending app either 64 bit encode it or use hex ...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
sretsea_12 |
Posted: Mon Dec 19, 2011 10:31 pm Post subject: |
|
|
Newbie
Joined: 17 Dec 2011 Posts: 8
|
Is there any provision in XMS.net API |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Dec 19, 2011 10:39 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
sretsea_12 wrote: |
Is there any provision in XMS.net API |
No this has nothing to do with the XMS.net API but everything to do with a value being set to a property... hence a programing error.
sretsea_12 wrote: |
XMS.net itself manages about the conversion we need not explicitly set the ccid |
WRONG. The default may well be the CCSID of the qmgr and that may not support the char set in the message. Set explicitely the CCSID on the connection factory to UTF-8 to avoid a translation into a CCSID that does not support all the characters in the message.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
sretsea_12 |
Posted: Wed Dec 21, 2011 5:43 am Post subject: |
|
|
Newbie
Joined: 17 Dec 2011 Posts: 8
|
any other way ?
Other team is simply saying they are able to do it using JAVA API.
Is this is a issue with xms.net API? |
|
Back to top |
|
 |
Vitor |
Posted: Wed Dec 21, 2011 5:57 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
sretsea_12 wrote: |
Other team is simply saying they are able to do it using JAVA API. |
I can do a lot of things with a COBOL program which will confuse a C application trying to process my output. What's the point?
sretsea_12 wrote: |
Is this is a issue with xms.net API? |
No, it's an issue with the way the message is being constructed. The fact that the other team can get it working with a Java application which (I'm confident) is in the same platform and environment as their sender doesn't mean it's not incorrectly formed. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
JasonE |
Posted: Wed Dec 21, 2011 6:04 am Post subject: |
|
|
Grand Master
Joined: 03 Nov 2003 Posts: 1220 Location: Hursley
|
Quote: |
Description= ' ', hexadecimal value 0x06, is an invalid character.
Line 1, position 351. |
This doesnt look like a message from MQ / XMS, more from the application
Quote: |
Other team is simply saying they are able to do it using JAVA API. |
Java or JMS? Able to do what? Does it do the same as the code which is generating that message?
What *exactly* is the app doing when it detects the error?
I would concur with an earlier poster - it sounds like someone has put the correlid into a string as its binary value, and that you are asking for trouble anyway. |
|
Back to top |
|
 |
rekarm01 |
Posted: Wed Dec 21, 2011 12:03 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
sretsea_12 wrote: |
got some info on the message
RFH
MQSTR
...
<ESB_StartTime>1323924269163</ESB_StartTime><CorrelationId>AMQ QM2 NÃ Ã I Â
</CorrelationId>
...
|
Unfortunately, any problem bytes don't copy-paste well; without MQMD info and a hex dump of the remainder of the source message, (just before the point where the target app would consume it), it's difficult to tell exactly what's wrong with the message.
As fjb_saper pointed out, the <CorrelationId> is a likely suspect, but there could be other problems with the message too.
If there's a problem with the source message before it reaches the target application, then it is the source application that needs to fix it.
sretsea_12 wrote: |
Actually information is processed through different system and the same is appended while processing it. |
Appended how? There are other bits of the RFH2 header that need to change when "appending" NameValueData, so that it's interpreted as part of the RFH2 header, rather than the message body. |
|
Back to top |
|
 |
|