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 IndexIBM MQ API SupportRFH2 header causes 2334 - how to debug?

Post new topicReply to topic Goto page 1, 2  Next
RFH2 header causes 2334 - how to debug? View previous topic :: View next topic
Author Message
ThomasT
PostPosted: Wed Jun 17, 2009 2:13 am Post subject: RFH2 header causes 2334 - how to debug? Reply with quote

Novice

Joined: 23 Apr 2006
Posts: 12

Hi,

I try to build a RFH2 header by myself using the Java-MQ-API (not JMS).

I got a 2334 reason code when putting the message.
I cannot see what was wrong. But the problem is, I don't know how to debug what is wrong.

My Header looks like this:

RFH  ”  MQSTR 3 <mcd><Msd>jms_bytes</Msd></mcd> H<jms><Exp>0</Exp><Pri>0</Pri><Dlv>0</Dlv><Tms>0</Tms><Seq>0</Seq></jms>

Is this correct so far? (except the bytes you dont see...but I'm assuming the xml-snippets are wrong.)

Thanks for help
Thomas
Back to top
View user's profile Send private message
vol
PostPosted: Wed Jun 17, 2009 2:21 am Post subject: Reply with quote

Acolyte

Joined: 01 Feb 2009
Posts: 69

it is much more likely that the unseen bits are wrong. the XML is not parsed, only the header values.
Post a hex dump of the header.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Jun 17, 2009 2:27 am Post subject: Re: RFH2 header causes 2334 - how to debug? Reply with quote

Grand High Poobah

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

ThomasT wrote:
I try to build a RFH2 header by myself using the Java-MQ-API (not JMS).


Why not use JMS? Why reinvent the wheel?

ThomasT wrote:
I got a 2334 reason code when putting the message.
I cannot see what was wrong. But the problem is, I don't know how to debug what is wrong.


I'd guess the field alignment is wrong. The unseen bits.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
WMBDEV1
PostPosted: Wed Jun 17, 2009 2:29 am Post subject: Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

Its hard to tell when we cant see all the bytes! My first response is to ensure the fields are padded correctly according to the MQRFH2 specification (which requires the lengths of some of the folders to be multiples of 4).

Code has been posted on this forum on how to create the headers using non jms apis. Have a search for this as it should be useful to you.

Why cant you use the jms apis?
Back to top
View user's profile Send private message
WMBDEV1
PostPosted: Wed Jun 17, 2009 2:37 am Post subject: Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

Link to the MQRFH2 format, if it helps.....

http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp?topic=/com.ibm.mq.csqzaw.doc/jm25440_.htm
Back to top
View user's profile Send private message
ThomasT
PostPosted: Wed Jun 17, 2009 3:15 am Post subject: Reply with quote

Novice

Joined: 23 Apr 2006
Posts: 12

Hi,

here the byte dump.

Code:

52 46 48 20 00 00 00 02 00 00 00 94 00 00 01 11
00 00 00 00 4d 51 53 54 52 20 20 20 00 00 00 00
00 00 03 33 00 00 00 20 3c 6d 63 64 3e 3c 4d 73
64 3e 6a 6d 73 5f 62 79 74 65 73 3c 2f 4d 73 64
3e 3c 2f 6d 63 64 3e 20 00 00 00 48 3c 6a 6d 73
3e 3c 45 78 70 3e 30 3c 2f 45 78 70 3e 3c 50 72
69 3e 30 3c 2f 50 72 69 3e 3c 44 6c 76 3e 30 3c
2f 44 6c 76 3e 3c 54 6d 73 3e 30 3c 2f 54 6d 73
3e 3c 53 65 71 3e 30 3c 2f 53 65 71 3e 3c 2f 6a
6d 73 3e 20 54 68 fc 73 20 69 73 20 f6 6e 6c 79
20 61 20 74 e4 73 74 2e
[/code]
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Jun 17, 2009 3:45 am Post subject: Reply with quote

Grand High Poobah

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

Well there you have it.

You've still not explained why you're trying to re-invent the wheel with this.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
ThomasT
PostPosted: Wed Jun 17, 2009 3:54 am Post subject: Reply with quote

Novice

Joined: 23 Apr 2006
Posts: 12

There are differnent kind of wheels, so inventing a one can make sense...

I used the normal API because I thought (indeed still think) it would give me more and better access to MQ. E.g. with a JMSTextmessage it seems not to have access to the raw bytes.

Maybe I'm wrong.

But It should be possible to program it myself. I simply cannot see the problem. I think I've done all right.

Of couse I looked successfully for some code snippets here. So I'm inventing the wheel but not all spokes ...
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Jun 17, 2009 4:04 am Post subject: Reply with quote

Grand High Poobah

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

ThomasT wrote:
There are differnent kind of wheels, so inventing a one can make sense...


Granted, but standards become standards for a reason.

ThomasT wrote:
I used the normal API because I thought (indeed still think) it would give me more and better access to MQ. E.g. with a JMSTextmessage it seems not to have access to the raw bytes.


No, a text message is deliberately presented as a string. If you want binary data you use JMSBytemessage (or however it's spelt).

ThomasT wrote:
Maybe I'm wrong.


I certainly struggle to see what "better" access to WMQ you'll get via the native interface especially as you're trying to manipulate the RFH2, who's principle purpose in native WMQ is to hold JMS properties that don't fit in the MQMD.

ThomasT wrote:
But It should be possible to program it myself. I simply cannot see the problem. I think I've done all right.


It is possible but seldom worth the effort, the problem is the alignment is wrong and no you haven't
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
ThomasT
PostPosted: Wed Jun 17, 2009 4:15 am Post subject: Reply with quote

Novice

Joined: 23 Apr 2006
Posts: 12

*what* exactly is wrong?
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Jun 17, 2009 4:17 am Post subject: Reply with quote

Grand High Poobah

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

ThomasT wrote:
*what* exactly is wrong?


WMBDEV1 wrote:
ensure the fields are padded correctly according to the MQRFH2 specification (which requires the lengths of some of the folders to be multiples of 4).

_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Wed Jun 17, 2009 7:32 am Post subject: Re: RFH2 header causes 2334 - how to debug? Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3264
Location: London, ON Canada

ThomasT wrote:
I try to build a RFH2 header by myself using the Java-MQ-API (not JMS).

Manually creating a RFH2 header (outside of JMS) is complex. You have to worry about 4-byte alignment, padding, setting section length values, etc...

Read the last couple of comments in the following posting and it should shed some light on your mistakes:
http://www.mqseries.net/phpBB2/viewtopic.php?t=14224

Regards,
Roger Lacroix
Capitalware inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
ThomasT
PostPosted: Wed Jun 17, 2009 8:02 am Post subject: Reply with quote

Novice

Joined: 23 Apr 2006
Posts: 12

I read the original documentation, I searched in the forum (code snippet, tipps), I reverse-engineered a JMS header. All I can see is that there is no error, all values correct an on the right place. But there *must* be a mistake...

It tried to add no named parts at all. -> 2334
It tried to add two dummy named parts with each one byte 0x55 and 0x56.
Each with a 4byte integer with value 1 for its length before.
Of course the RFH2 StrucLength was set to 46 (decimal).
-> 2334.

Someone wrote that the named parts are not parsed. So it should work, doesn't it?


Writing an RFH2-Header is less complicated that e.g. a TIFF-Image. Well...it should...;-(

My code is this:

Code:
public void createAndWrite(final MQMessage mQmessage, final Message input) throws IBMMQException{
      try
      {
       
        //create header
        rfhStrucID        = MQC.MQRFH_STRUC_ID;
        rfhVersion        = MQC.MQRFH_VERSION_2;           
        rfhStrucLength    = MQC.MQRFH_STRUC_LENGTH_FIXED_2; //==36
        rfhEncoding       = MQC.MQENC_NATIVE;               
        rfhCodedCharSetId = MQC.MQCCSI_DEFAULT;             
        rfhFormat         = input.getText() != null ? MQC.MQFMT_STRING : MQC.MQFMT_NONE;         
        rfhFlags          = 0;                              //MQC.MQRFH_NO_FLAGS
        rfhNameValueCCSID = 819;                     //1208 - UTF-8
       
        //create XML-snippets
        mcd = RFH2_MCD.create(input);
        jms = RFH2_JMS.create(input);
        usr = RFH2_USR.create(input);
       
        //create bytes of XML-snippets (they have already lengths of mulitples of 4)
        final byte[] mcdBytes = mcd.getBytes(rfhNameValueCCSID);
        final byte[] jmsBytes = jms.getBytes(rfhNameValueCCSID);
        final byte[] usrBytes = usr != null ? usr.getBytes(rfhNameValueCCSID) : null;
       
        if (mcdBytes != null) rfhStrucLength += mcdBytes.length + 4; //4 bytes of length integer
        if (jmsBytes != null) rfhStrucLength += jmsBytes.length + 4; //4 bytes of length integer
        if (usrBytes != null) rfhStrucLength += usrBytes.length + 4; //4 bytes of length integer
     
        //write header
        mQmessage.writeString(rfhStrucID);
        mQmessage.writeInt4(rfhVersion);
        mQmessage.writeInt4(rfhStrucLength);
        mQmessage.writeInt4(rfhEncoding);
        mQmessage.writeInt4(rfhCodedCharSetId);
        mQmessage.writeString(rfhFormat);
        mQmessage.writeInt4(rfhFlags);
        mQmessage.writeInt4(rfhNameValueCCSID);
       
        //write XML-snippets and their lengths
        if (mcdBytes != null){
          mQmessage.writeInt4(mcdBytes.length);
          mQmessage.write(mcdBytes);
        }
        if (jmsBytes != null){
          mQmessage.writeInt4(jmsBytes.length);
          mQmessage.write(jmsBytes);
        }
        if (usrBytes != null){
          mQmessage.writeInt4(usrBytes.length);
          mQmessage.write(usrBytes);
        }
       
      }
      catch (IOException ioex){
        throw new IBMMQException(ERRCODE_CREATING_RFH2, ERRMSG_CREATING_RFH2, ioex);
      }
    }
Back to top
View user's profile Send private message
ThomasT
PostPosted: Wed Jun 17, 2009 8:37 am Post subject: Solution found! Reply with quote

Novice

Joined: 23 Apr 2006
Posts: 12

Code:
rfhCodedCharSetId = MQC.MQCCSI_DEFAULT;


This was the problem. It seems 0 is not allowed here. Changing this to

Code:
rfhCodedCharSetId = 819;


works nearly perfectly...until the next bug I'll found now...
Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Wed Jun 17, 2009 8:58 am Post subject: Re: Solution found! Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3264
Location: London, ON Canada

ThomasT wrote:
Code:
rfhCodedCharSetId = MQC.MQCCSI_DEFAULT;


This was the problem. It seems 0 is not allowed here. Changing this to

Code:
rfhCodedCharSetId = 819;

Actually, you should be doing:
Code:
rfhCodedCharSetId = MQC.MQCCSI_INHERIT;


Also, why are you converting MCD, JMS & USR folders to byte arrays? They should be string (aligned on a 4-byte boundary and padded with blanks - if necessary).
i.e.
http://www.mqseries.net/phpBB/viewtopic.php?p=248595

Regards,
Roger Lacroix
Capitalware inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:
Post new topicReply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum IndexIBM MQ API SupportRFH2 header causes 2334 - how to debug?
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.