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 » Sending RFH2 messages in VB

Post new topic  Reply to topic
 Sending RFH2 messages in VB « View previous topic :: View next topic » 
Author Message
MillsPerry
PostPosted: Mon Jan 14, 2002 12:07 pm    Post subject: Reply with quote

Acolyte

Joined: 08 Oct 2001
Posts: 59
Location: ZyQuest, inc.

Has anybody used RFH2 headers in VB?

I have written a Visual Basic Program to send an RFH2 command to the MQSeries Integrator broker. It is failing because the NameValueCCSID could not translate from code page 1151. This is odd because I am specifying code page 1208 (UTF-. My best guess is that my RFH2 header must have the position of the name value pairs off by a byte or two, and so Integrator is reading garbage in the message. However, I can't find the bug in my layout. Here is what I have:

Client & server both Win2k.


RFH2 Header:
StrucId String*4 "RFH "
Version Long 2
StrucLength Long 36 + 4 + length of my name value data
Encoding Long &H222 (MQENC_NATIVE)
CodedCharSetId Long -2 (MQCCSI_INHERIT)
Format String*8 Spaces
Flags Long 0
NameValueCCSID Long 1208
NameValueLength Long Length of my XML string.
NameValueData String XML command string.

MQMD Header:
Format = "MQHRF2 "
MessageType = MQMT_REQUEST


I put everything except NameValueData into a user defined data type. Then I used the CopyMem API function to
serialize it into a string, and then appended the NameValueData to that. I send it to the SYSTEM.BROKER.CONTROL.QUEUE and then get the error messages in the event log.

I would appreciate any advice on what I'm doing wrong.


[ This Message was edited by: MillsPerry on 2002-01-14 12:09 ]

[ This Message was edited by: MillsPerry on 2002-01-14 12:10 ]

[ This Message was edited by: MillsPerry on 2002-01-14 12:11 ]

[ This Message was edited by: MillsPerry on 2002-01-14 12:12 ]

Back to top
View user's profile Send private message Send e-mail
StefanSievert
PostPosted: Mon Jan 14, 2002 12:16 pm    Post subject: Reply with quote

Partisan

Joined: 28 Oct 2001
Posts: 333
Location: San Francisco

Hi,
can you try to send your message to a different local queue, then use amqsbcg to browse the queue and redirect the output to a file to post it here? It might be easier to see what's wrong if you are providing a hex dump of the message.
Could you do that?
Thanks,
Stefan

_________________
Stefan Sievert
IBM Certified * WebSphere MQ
Back to top
View user's profile Send private message
MillsPerry
PostPosted: Mon Jan 14, 2002 2:34 pm    Post subject: Reply with quote

Acolyte

Joined: 08 Oct 2001
Posts: 59
Location: ZyQuest, inc.


AMQSBCG0 - starts here
**********************

MQOPEN - 'WMIS.TEST_OUT'


MQGET of message number 1
****Message descriptor****

StrucId : 'MD ' Version : 2
Report : 0 MsgType : 1
Expiry : -1 Feedback : 0
Encoding : 546 CodedCharSetId : 437
Format : 'MQHRF2 '
Priority : 0 Persistence : 1
MsgId : X'414D5120514D4D5153494E5444312020C4F0173C1240D913'
CorrelId : X'000000000000000000000000000000000000000000000000'
BackoutCount : 0
ReplyToQ : 'WMIS.TEST '
ReplyToQMgr : 'QMMQSINTD1 '
** Identity Context
UserIdentifier : 'MQAdmin '
AccountingToken :
X'16010515000000F89FB4747ABAF754833D2B46C805000000000000000000000B'
ApplIdentityData : ' '
** Origin Context
PutApplType : '11'
PutApplName : '2.0.1binDataFlowEngine.exe'
PutDate : '20020114' PutTime : '20350726'
ApplOriginData : ' '

GroupId : X'000000000000000000000000000000000000000000000000'
MsgSeqNumber : '1'
Offset : '0'
MsgFlags : '0'
OriginalLength : '-1'

**** Message ****

length - 202 bytes

00000000: 5246 4820 0200 0000 7F00 0000 2202 0000 'RFH ........"...'
00000010: 7F98 9898 2020 2020 2020 2020 0000 0000 '.˜˜˜ ....'
00000020: 7F04 0000 7F00 0000 3C70 7363 3E3C 436F '........ 00000030: 6D6D 616E 643E 5265 6753 7562 3C2F 436F 'mmand>RegSub 00000040: 6D6D 616E 643E 3C54 6F70 6963 3E4D 4D53 'mmand>MMS'
00000050: 2F44 4952 4543 5420 4953 5355 453C 2F54 '/DIRECT ISSUE 00000060: 6F70 6963 3E3C 5375 6250 6F69 6E74 3E3C 'opic><'
00000070: 2F53 7562 506F 696E 743E 3C46 696C 7465 '/SubPoint> 00000080: 723E 3C2F 4669 6C74 6572 3E3C 514D 6772 'r> 00000090: 4E61 6D65 3E51 4D4D 5153 494E 5444 313C 'Name>QMMQSINTD1<'
000000A0: 2F51 4D67 724E 616D 653E 3C51 4E61 6D65 '/QMgrName> 000000B0: 3E57 4D49 532E 5445 5354 3C2F 514E 616D '>WMIS.TEST 000000C0: 653E 3C2F 7073 633E 0D0A 'e>
.. '


MQGET of message number 2
****Message descriptor****

StrucId : 'MD ' Version : 2
Report : 0 MsgType : 1
Expiry : -1 Feedback : 0
Encoding : 546 CodedCharSetId : 437
Format : 'MQHRF2 '
Priority : 0 Persistence : 1
MsgId : X'414D5120514D4D5153494E5444312020C4F0173C12A0D913'
CorrelId : X'000000000000000000000000000000000000000000000000'
BackoutCount : 0
ReplyToQ : 'WMIS.TEST_OUT '
ReplyToQMgr : 'QMMQSINTD1 '
** Identity Context
UserIdentifier : 'MQAdmin '
AccountingToken :
X'16010515000000F89FB4747ABAF754833D2B46C805000000000000000000000B'
ApplIdentityData : ' '
** Origin Context
PutApplType : '11'
PutApplName : '2.0.1binDataFlowEngine.exe'
PutDate : '20020114' PutTime : '20363224'
ApplOriginData : ' '

GroupId : X'000000000000000000000000000000000000000000000000'
MsgSeqNumber : '1'
Offset : '0'
MsgFlags : '0'
OriginalLength : '-1'

**** Message ****

length - 202 bytes

00000000: 5246 4820 0200 0000 7F00 0000 2202 0000 'RFH ........"...'
00000010: 7F98 9898 2020 2020 2020 2020 0000 0000 '.˜˜˜ ....'
00000020: 7F04 0000 7F00 0000 3C70 7363 3E3C 436F '........ 00000030: 6D6D 616E 643E 5265 6753 7562 3C2F 436F 'mmand>RegSub 00000040: 6D6D 616E 643E 3C54 6F70 6963 3E4D 4D53 'mmand>MMS'
00000050: 2F44 4952 4543 5420 4953 5355 453C 2F54 '/DIRECT ISSUE 00000060: 6F70 6963 3E3C 5375 6250 6F69 6E74 3E3C 'opic><'
00000070: 2F53 7562 506F 696E 743E 3C46 696C 7465 '/SubPoint> 00000080: 723E 3C2F 4669 6C74 6572 3E3C 514D 6772 'r> 00000090: 4E61 6D65 3E51 4D4D 5153 494E 5444 313C 'Name>QMMQSINTD1<'
000000A0: 2F51 4D67 724E 616D 653E 3C51 4E61 6D65 '/QMgrName> 000000B0: 3E57 4D49 532E 5445 5354 3C2F 514E 616D '>WMIS.TEST 000000C0: 653E 3C2F 7073 633E 0D0A 'e>
.. '



No more messages
MQCLOSE
MQDISC
Back to top
View user's profile Send private message Send e-mail
MillsPerry
PostPosted: Mon Jan 14, 2002 3:05 pm    Post subject: Reply with quote

Acolyte

Joined: 08 Oct 2001
Posts: 59
Location: ZyQuest, inc.

In case this is useful, here are the event log messages I get when attempting to subscribe:


( BKMQSINTD1.CIS.ORDERS ) Error '4' converting a character string to or from codepage '1151'.

A character conversion between codepages has failed. This may be due to an invalid codepage being specified in the header of a message, or may be due to a character being present in a message that does not appear in the required codepage conversion table.

Check that the application that generated the message is using a valid codepage in the message header and that all characters used are valid in that codepage.


( BKMQSINTD1.CIS.ORDERS ) An error occurred in parser 'MQRFH2' whilst parsing the field named 'NameValueCCSID' on behalf of node 'PubSubControlMsgFlow.InputNode'. The data being parsed was '52464820020000007f000000220200007f9898982020202020202020000000007f0400007f0000003c7073633e3c436f6d6d616e643e5265675375623c2f436f6d6d616e643e3c546f7069633e4d4d532f4449524543542049535355453c2f546f7069633e3c537562506f696e743e3c2f537562506f696e743e3c46696c74'.

This message gives the name of the field in the parser that was being parsed at the time the error occurred.

You should check for other messages issued with this one for the full context of the error.


( BKMQSINTD1.CIS.ORDERS ) Exception condition detected on input node 'PubSubControlMsgFlow.InputNode'.

The input node 'PubSubControlMsgFlow.InputNode' detected an error whilst processing a message. The message flow has been rolled-back and, if the message was being processed in a unit of work, it will remain on the input queue to be processed again. Following messages will indicate the cause of this exception.

Check the error messages which follow to determine why the exception was generated, and take action as described by those messages.
Back to top
View user's profile Send private message Send e-mail
StefanSievert
PostPosted: Mon Jan 14, 2002 4:39 pm    Post subject: Reply with quote

Partisan

Joined: 28 Oct 2001
Posts: 333
Location: San Francisco

Perry (or is it Mills?),
a couple of observations:

1) Your XML string alone is 162 Bytes long, your NameValueLength field is set to 0x7F (=127). The StrucLength is set to the same value!?
2) You set your CodedCharSetId in the MD to -2 (MQCCSI_INHERITED). The documentation I have at hand knows only {0, -1} as valid values. Apart from that, the hex value for -2 should be 0xFEFFFFFF. Your message contains 0x7F989898.
3) There is a CRLF (0D0A) at the end of your message. Is that intended?
4) The CCSID value actually IS set to 0x47F, which is indeed 1151

So, without exactly knowing why your CCSID gets set to 1151, you should check your length fields and, my biggest suspicion is the -2 value in your MD. Where did you get that value from?
This is just a shot in the dark, but maybe it will get you started. Please keep us posted.
Stefan

PS. The VB include file cmqb.bas contains a definition of the RFH and a routine to set it to the following defaults:
Sub MQRFH_DEFAULTS (Struc As MQRFH)
Struc.StrucId = MQRFH_STRUC_ID
Struc.Version = MQRFH_VERSION_1
Struc.StrucLength = MQRFH_STRUC_LENGTH_FIXED
Struc.Encoding = MQENC_NATIVE
Struc.CodedCharSetId = MQCCSI_UNDEFINED
Struc.Format = MQFMT_NONE
Struc.Flags = MQRFH_NONE
End Sub

It looks like StrucLength is the length of this structure only, excluding your NameValue data. But as you mentioned in your original post, You might need to use an RFH2 header though, so this might be of no use to you, but it could at least give you a hint for the setting of Encoding/CodedCharSetId.
_________________
Stefan Sievert
IBM Certified * MQSeries


[ This Message was edited by: StefanSievert on 2002-01-14 18:02 ]
Back to top
View user's profile Send private message
MillsPerry
PostPosted: Tue Jan 15, 2002 8:21 am    Post subject: Reply with quote

Acolyte

Joined: 08 Oct 2001
Posts: 59
Location: ZyQuest, inc.

Hi Stefan,

I am using an IBM supplied book titled "MQSeries Integrator Programming Guide" with the file name BIPYAL01.pdf which I got from IBM's MQSeries download page. Chapter 4 contains the description of the MQRFH2 header which I am using.

I looked at CMQB.bas, and could find no definition for the RFH2 header - just RFH, which is an older structure. Since we seem to be operating on different sets of rules, were you talking about RFH or RFH2? I would like to stick with RFH2.

There appears to be a discrepancy between what I am putting into the fields and what is comming out of MQSeries.
1. I am setting NameValueLength to 164 (162 padded to a multiple of 4.
2. I am setting StrucLength to 204
3. I did not add the CrLf. Perhaps the XML parser did (MSXML). Or maybe this is just one more discrepancy between what I put in the message and what came out.

I could go on, but you get the idea. Something appears to be scrambling my RFH2 header.

After building the header, I use the CopyMem Win32 API to convert the structure to a string so I can pass it to MQMsg.MessageData. I will re-examine the hex value of that string to verify that the CopyMem isn't scrambling my data. If that string is correct, then we need to examine why the data is getting scrambled. I will post back with my results.

Mills Perry
Back to top
View user's profile Send private message Send e-mail
MillsPerry
PostPosted: Tue Jan 15, 2002 8:44 am    Post subject: Reply with quote

Acolyte

Joined: 08 Oct 2001
Posts: 59
Location: ZyQuest, inc.

Here are the byte values for my RFH2 header as I am sending it to MQSeries.
Note that the numbers are decimal representations or the value of each byte.
This shows that I am putting the appropriate data into the header,
unless there is something I am missing.










StrucId82707232
Version2000
Struclength204000
Encoding34200
CodedCharSetId254255255255
Format3232323232323232
Flags0000
NameValueCCSID184400
NameValueLength164000


[ This Message was edited by: MillsPerry on 2002-01-15 08:46 ]

[ This Message was edited by: MillsPerry on 2002-01-15 08:48 ]

[ This Message was edited by: MillsPerry on 2002-01-15 08:53 ]
Back to top
View user's profile Send private message Send e-mail
MillsPerry
PostPosted: Tue Jan 22, 2002 12:26 pm    Post subject: Reply with quote

Acolyte

Joined: 08 Oct 2001
Posts: 59
Location: ZyQuest, inc.

OK, to close this thread out, I have learned that I should use the
WriteUnsignedByte method of the MQMsg object to put binary data into
the Message buffer. Otherwise, either VB or MQAX200 will convert
the string containing the binary header into garbage.

Thanks to everybody who helped!

[ This Message was edited by: MillsPerry on 2002-01-22 12:27 ]
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 » Sending RFH2 messages in VB
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.