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 » IBM MQ API Support » Problem with XMS "client unmanaged"

Post new topic  Reply to topic
 Problem with XMS "client unmanaged" « View previous topic :: View next topic » 
Author Message
kirschler
PostPosted: Wed Aug 20, 2008 5:43 am    Post subject: Problem with XMS "client unmanaged" Reply with quote

Newbie

Joined: 24 Oct 2007
Posts: 5

Hi,

I have an application (developed in C# .NET) that is sending XMS messages to a queue manager.
Everything works fine when I'm using connection mode "client" (WMQ_CM_CLIENT).

When I switch to use connection mode "client unmanaged" (WMQ_CM_CLIENT_UNMANAGED) some characters of the text of the message body is encoded different (swedish characters).
The only thing that differs between the two scenarios is the connection mode setting - everything else is the same.
The application is using UTF8 and I have tested using Bytes and Text message with same results.

Anybody got an idea how to solve this?


My installation:
Windows XP Pro
IBM Message Service Client for .NET 1.2.6.0
IBM Websphere MQ For Windows, Version 6.0.2.3 (Client)

/Peter
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Aug 20, 2008 2:55 pm    Post subject: Re: Problem with XMS "client unmanaged" Reply with quote

Grand High Poobah

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

kirschler wrote:
Hi,

I have an application (developed in C# .NET) that is sending XMS messages to a queue manager.
Everything works fine when I'm using connection mode "client" (WMQ_CM_CLIENT).

When I switch to use connection mode "client unmanaged" (WMQ_CM_CLIENT_UNMANAGED) some characters of the text of the message body is encoded different (swedish characters).
The only thing that differs between the two scenarios is the connection mode setting - everything else is the same.
The application is using UTF8 and I have tested using Bytes and Text message with same results.

Anybody got an idea how to solve this?


My installation:
Windows XP Pro
IBM Message Service Client for .NET 1.2.6.0
IBM Websphere MQ For Windows, Version 6.0.2.3 (Client)

/Peter

Are you setting the right ccsid on your messages?
Also remember that there is no such thing as utf-8 in .NET. The internal representation of a .NET string is unicode (CCSID 1200).
The default code page would be either 437 or 850...
If the msgs do not have the CCSID set the qmgr will assume the default of the client platform... not a good fit there.
To write the message in the correct ccsid you need to set it on the message. Use CCSID 1200 if you use plain string or use ccsid 1208 (utf-8 ) if you first translate your text to utf-8 (standard .net routines for that)

Also make sure that the client reading the message requests the message with UTF-8 and uses the correct convert option on text messages.

And with JMS/XMS you can set the CCSID on the qcf/tcf as this will then be passed onto the msg.

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kirschler
PostPosted: Thu Aug 21, 2008 12:19 am    Post subject: Re: Problem with XMS "client unmanaged" Reply with quote

Newbie

Joined: 24 Oct 2007
Posts: 5

Hi,

Quote:

Are you setting the right ccsid on your messages?


The thing is that I don't set any CCSID at all - when the application is using connection mode "client" this seems to work automatically. Perhaps this is taken care of when the client is fully managed. I have tried to set the CCSID on the msg when using "client unmanaged" (se code below).

Quote:

Also remember that there is no such thing as utf-8 in .NET. The internal representation of a .NET string is unicode (CCSID 1200).


What I meant was that the application is streaming the text to UTF8 before it creates a TextMessage to send.

I have tried to set various CCSID on the message object before sending it and it seems that it makes no difference at all.
Below is a code snippet to show what I'm doing before the Send().

Code:

reader = new StreamReader(adapterMessage.BodyStream, System.Text.Encoding.UTF8);                     
messageBody = reader.ReadToEnd();
msg = session.CreateTextMessage(messageBody);
msg.SetIntProperty(XMSC.WMQ_CCSID, XMSC.CCSID_UTF8);


I have not yet tried to set the CCSID on the connection factory...

/Peter
Back to top
View user's profile Send private message
kirschler
PostPosted: Thu Aug 21, 2008 12:27 pm    Post subject: Re: Problem with XMS "client unmanaged" Reply with quote

Newbie

Joined: 24 Oct 2007
Posts: 5

Just tried to set the CCSID on the connection factory without any success...

/Peter
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Aug 21, 2008 5:34 pm    Post subject: Reply with quote

Grand High Poobah

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

What are you using to verify the message on the receiving client?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kirschler
PostPosted: Thu Aug 21, 2008 10:18 pm    Post subject: Reply with quote

Newbie

Joined: 24 Oct 2007
Posts: 5

fjb_saper wrote:
What are you using to verify the message on the receiving client?


Since I ONLY change the connection mode (to "client unmanaged") in my app I use the same receiving client as when I use
connection mode "client". See below for a short description.

The solution is a Web service which I test using SoapUI (a utility for testing SOAP-calls):

1. a request is sent from SoapUI to WMB (HTTP Input)
2. several message flows are executed in WMB (using MQ contract queues)
3. the request is processed by an adapter
4. a response message is built by an adapter
5. the response is sent back to WMB (this is where I can toggle between "client" and "unmanaged client")
6. WMB correlates the response and the request
7. a HTTP response is received by SoapUI

When I use "client" I can save the response in SoapUI (to file) and display it correctly in Internet Explorer.
When I use "client unmanaged" the same procedure will produce an error in IE ("An invalid character was found in text content...").

A while back ago I stopped the response message flow in WMB and examined the response message using RfhUtil for both
scenarios. I don't remember the details but the message body was encoded different regarding swedish characters when using
"client unmanaged". The "Code Page"-box in the "MQMD"-tab differed too.

I will make a new test with RfhUtil and get back with the result.

/Peter
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Aug 22, 2008 9:38 am    Post subject: Reply with quote

Grand High Poobah

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

Using RFHUtil make sure you look at the hex values and set the CCSID if you use convert... RFHUtil does not display UTF-8....
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kirschler
PostPosted: Thu Aug 28, 2008 4:41 am    Post subject: Reply with quote

Newbie

Joined: 24 Oct 2007
Posts: 5

fjb_saper wrote:
Using RFHUtil make sure you look at the hex values and set the CCSID if you use convert... RFHUtil does not display UTF-8....


I have now checked the message and its properties.
The mixed up characters (swedish characters not showing correctly) is caused by the WMB trying to CAST the body (encoded in C# as UTF8 text) in a Compute node and store the text in a variable.

Before the message hits the broker (and the Compute node) an application creates the message and sends it to a queue.
When the application uses "Client" connection mode the CodePage in MQMD is set to 1252 (automatically by XMS). The CAST in the Compute node in the broker works using CodePage 1252 (MQMD) to convert the UTF8-encoded text.

But when "ClientUnmanaged" connection mode is used the CodePage is always set to 437 in MQMD - no matter how I try to set 1252 or 1208 in the code. This results in the WMB trying to CAST a UTF8 encoded text using CodePage 437 (stated in MQMD). Not very good.

So... the question is: How on earth do I set the CodePage in the MQMD of the XMS message (TextMessage) sent to my queue using "ClientUnmanaged"???

I have tried to set it on the message object and the connection factory without any luck...

Anyone?

/Peter
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Aug 28, 2008 2:49 pm    Post subject: Reply with quote

Grand High Poobah

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

Looks that now we are getting somewhere.
Just to make sure I understand:
  • Your message is in CCSID 1208 - UTF-8
  • your receiver (XMS) connects to a qmgr with a default CCSID of 437, comming from a platform with a default CCSID 437.
  • your message is a text message (MQFMT_STRING)


Going with pure JMS I would set the CCSID 1208 on the receiver's qcf/tcf so that when the message is requested from the qmgr it is requested in CCSID 1208 and does not get translated.

Now I would suggest you read up on the XMS manual if you can set the CCSID on your qcf/tcf the same way.
If you have a method where you need to pass in "a" message to retrieve the message make sure that the message passed in has a setting of 1208 on its CCSID.

If this does not work, open a PMR with IBM/Support pack owner.

Hope it helps
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Problem with XMS "client unmanaged"
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.