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 » .NET and J2EE Interoperability using WebSphere MQ

Post new topic  Reply to topic
 .NET and J2EE Interoperability using WebSphere MQ « View previous topic :: View next topic » 
Author Message
kendras
PostPosted: Wed Dec 20, 2006 7:35 am    Post subject: .NET and J2EE Interoperability using WebSphere MQ Reply with quote

Novice

Joined: 31 Jan 2006
Posts: 12

Hi guys,

I've a .Net Client whitch put a message on a mq file, and a java client that read the message.
I've got an error. I think that is due to the a problem of interoperability.

I've read this article : A Basic .NET and J2EE Interoperability using WebSphere MQ, and try their samples, but it does not work at all.

Is there somebody to help me ?

Thanks
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Dec 20, 2006 7:39 am    Post subject: Re: .NET and J2EE Interoperability using WebSphere MQ Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

kendras wrote:
Is there somebody to help me ?


There are really quite a few of us.

Something a bit more detailed than "I've got an error" would get a more helpful response. Also details of what version of MQ & .NET you're using would be nice.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
kendras
PostPosted: Wed Dec 20, 2006 7:44 am    Post subject: Reply with quote

Novice

Joined: 31 Jan 2006
Posts: 12

Yeah of course

My original message is :
Code:
<balise>
      <pouet>test</pouet>
</balise>


When i write with the WriteString method (queueMessage.WriteString( message ) ), the java client get a message like this :
Quote:
<balise>
<pouet>test</pouet>
</balise>?>?>?>?>?>?>?>?>?>?>?>?>?>?>?>?>?>?>?>?>?



If i use WriteUTF( message ) (queueMessage.WriteUTF( message )), an error is occured in the java client
An IOException occured while writing to the message buffer: java.io.EOFException

(sorry for my language, i'm french )
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Dec 20, 2006 7:49 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

How long is "message"?

You will use WriteString, you will not use WriteUTF.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Dec 20, 2006 3:44 pm    Post subject: Reply with quote

Grand High Poobah

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

And remember string conversions in .NET where the default is unicode and not UTF-8....

Make sure when you write to the queue that the buffer is clean. Always clear/initialize the buffer before setting the message content into the buffer.
Always make sure the buffer length is correct before starting the put operation...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kendras
PostPosted: Thu Dec 21, 2006 1:08 am    Post subject: Reply with quote

Novice

Joined: 31 Jan 2006
Posts: 12

My message lenght is 36.
Code:
String message = "<balise><pouet>test</pouet></balise>";


First Test :
Code:
queueMessage.WriteUTF( message );


On The WMQ Server, my message is received as :
Quote:
$ <balise><pouet>test</pouet></balise>

=> Lengh : 38 ($ and a space have been added at the begining, i don't know why)
Code:
24 00 3C 62 61 6C 69 73  $.<balis
65 3E 3C 70 6F 75 65 74  e><pouet
3E 74 65 73 74 3C 2F 70  >test</p
6F 75 65 74 3E 3C 2F 62  ouet></b
61 6C 69 73 65 3E        alise>


Second Test :
Code:
queueMessage.WriteString( message );


On The WMQ Server, my message is received as :
Quote:
<balise><pouet>test</pouet></balise>


=> Lengh : 72 (i don't know why, it add 00 between char)

Code:
3C 00 62 00 61 00 6C 00  <.b.a.l.
69 00 73 00 65 00 3E 00  i.s.e.>.
3C 00 70 00 6F 00 75 00  <.p.o.u.
65 00 74 00 3E 00 74 00  e.t.>.t.
65 00 73 00 74 00 3C 00  e.s.t.<.
2F 00 70 00 6F 00 75 00  /.p.o.u.
65 00 74 00 3E 00 3C 00  e.t.>.<.
2F 00 62 00 61 00 6C 00  /.b.a.l.
69 00 73 00 65 00 3E 00  i.s.e.>.



Java client can't get both message...
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Dec 21, 2006 1:20 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Disclaimer - I know very little about Java. I could be talking rubbish.

1st test - it may just be a freaky coincidence, but X'24' = 36 in decimal, the length of your message without what looks like a little endian integer on the front of it-it's not a space it's a null, so is actually X'0024'. I think it's a length indicator been added by some means (buffer length incorporated into message??)

2nd test - you get that when unicode (double byte) is interpreted as a string. Possibly the other way round.

I think you need to sit down, work out how to set the code page on both sides, set a common string strategy (like write.String as per jefflowrey and make both sides common.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
kendras
PostPosted: Thu Dec 21, 2006 1:33 am    Post subject: Reply with quote

Novice

Joined: 31 Jan 2006
Posts: 12

AHHH YESS

I've found the method !

In my .Net client, i've used the WriteBytes Method, and on the java client, i've used the ReadString method, and it's work.

Thanks lot for help
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Dec 21, 2006 1:37 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

kendras wrote:

I've found the method !


If it works, it's a solution. Well done you.

kendras wrote:

Thanks lot for help


You're welcome.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Dec 21, 2006 2:52 pm    Post subject: Reply with quote

Grand High Poobah

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

kendras wrote:
AHHH YESS

I've found the method !

In my .Net client, i've used the WriteBytes Method, and on the java client, i've used the ReadString method, and it's work.

Thanks lot for help

Use the search button. You weren't listening.
The .NET default is CCSID 1200 (or unicode or utf-16) and has 00 in front of the char...
In order to write in UTF-8 you need to use some specific method or use something like .writeascii()(CCSID437)...
Anyways it should make no difference to your JMS/java app. Just have the format on the message set to MQSTR and set the correct CCSID and encoding on the message.

Remember to do a read with convert in base java

Enjoy
_________________
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 » .NET and J2EE Interoperability using WebSphere MQ
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.