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 » User Exits » Receiver Exit currputs files over 32KB size

Post new topic  Reply to topic
 Receiver Exit currputs files over 32KB size « View previous topic :: View next topic » 
Author Message
javagals
PostPosted: Thu Aug 28, 2008 6:02 am    Post subject: Receiver Exit currputs files over 32KB size Reply with quote

Apprentice

Joined: 13 Aug 2008
Posts: 34

Hello,

I have configured a custom receiver exit which extracts remote ip address from channel definition and populates it in "ApplicationIdentityData" field of MQMD.

If I transmit a file of over 32K size the file gets currupt. It is due to the fact that MQ slices files over 32K size and sends it in chunks. I have configured max message length to 4MB.

Could you please let me know how to resolve this issue?

Regards,
Sridhar Javagal
_________________
Sridhar Javagal
Solution design and delivery
Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Thu Aug 28, 2008 8:04 am    Post subject: Reply with quote

Jedi Knight

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

Hi,

My guess is that you modified the message data. Is your code passing back the original buffer to the MCA except when it modified the ApplicationIdentityData field?

Did you change the length of any buffers passed to your exit before the code passed them back to the MCA?

The first thing I would do is remove your code from the exit, so that it is a simple dummy exit, and test large files. If it works then the problem is with your code. If it does not then open a PMR with IBM and give them the dummy exit.

Also, we can't really help unless the code is posted. (Use the BBCode of [code] around your code so that it is easy to read.)

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
David.Partridge
PostPosted: Thu Aug 28, 2008 11:50 pm    Post subject: Reply with quote

Master

Joined: 28 Jun 2001
Posts: 249

I'm assuming that we are talking about an MQI channel (CLNTCONN/SVRCONN) here. If not look to use the message exit ...

If the MQPUT request (byte 10 of TSH == 0x86) is over one transmission segment in length then the second and subsequent buffers presented to the receive exit for an MPUT of a message won't have the same internal layout as the first one.

The first buffer will have the serialised API parameters including the MQMD, and then the data, the second and subsequent buffers will just contain the continuation for the data from the first buffer, and to sort that out you'll need to do your own reverse engineering of the TSH to work out if this is a continuation buffer (as distinct from the first buffer) for an MQPUT.

IBM do not publish the details of the TSH (Transmission Services Header?) as they consider it part of the confidential MQ Formats and Protocols definition.
_________________
Cheers,
David C. Partridge
Back to top
View user's profile Send private message
javagals
PostPosted: Fri Aug 29, 2008 1:28 am    Post subject: Reply with quote

Apprentice

Joined: 13 Aug 2008
Posts: 34

Thanks for your reply guys. I appreciate it.

Yes. It is a CLNTCONN/SVRCONN [MQI Channel]. It is definitely an issue with the code. I tested the message exit by commenting out ExitResponse2 which is set to MQXR2_USE_EXIT_BUFFER.

After I comment out ExitResponse2 exit use the agentbuffer and my changes wont get through. This way it works ok.

For internal business, it is essential to get client ip address in ApplicationIdentificationData field of the message header.

Following are the code snippet. Please let me know how to resolve this issue.

void MQENTRY RECVEXIT (
PMQVOID mqcxpptr, /* Channel exit parameter block MQCXP in/out */
PMQVOID mqcdptr, /* Channel definition MQCD in/out */
PMQLONG inmsglngptr, /* Length of data in/out */
PMQLONG inbuflngptr, /* Length of agent buffer in */
PMQVOID inbufptr, /* Agent buffer MQXQH+data in/out */
PMQLONG outmsglngptr, /* Length of exit buffer in/out */
PMQPTR outbufptr ) /* Address of exit buffer in/out */
{

PMQCXP pMQCXPptr ; // channel exit parameter block pointer.
PMQCD pMQCDptr ; // channel definition structure pointer.
PMQMD2 pMQMDptr; // Message descriptor

MQBYTE outMessage[*inmsglngptr+104]; // First 104 bytes are MQXQH contents
MQLONG outMessageLength=*inmsglngptr;
*outmsglngptr=outMessageLength;
PMQMD2 outMQMDptr;
MQCHAR BUFFER[32];


// Check the contents
...........


if(MyMQCD_ChannelType == MQCHT_SVRCONN) {
if(MyMQCXP_ExitId == MQXT_CHANNEL_RCV_EXIT){

memcpy (MyMQMD_ConnectionName, pMQCDptr->ConnectionName, sizeof(pMQCDptr->ConnectionName) ) ;
strtok(MyMQMD_ConnectionName, " ");

strcat(BUFFER, MyMQMD_ConnectionName);

memcpy(outMQMDptr->ApplIdentityData, BUFFER, sizeof(BUFFER)) ;
}
mTrace ( Trace_log_stream, "Outside MQXT_CHANNEL_RCV_EXIT" ) ;
}
mTrace ( Trace_log_stream, "Outside MQCHT_SVRCONN" ) ;
*outbufptr=outMessage;
*outmsglngptr=outMessageLength;
pMQCXPptr->ExitResponse2 = MQXR2_USE_EXIT_BUFFER; // indicate OK end.
pMQCXPptr->ExitResponse = MQXCC_OK ;



}
_________________
Sridhar Javagal
Solution design and delivery
Back to top
View user's profile Send private message
javagals
PostPosted: Fri Aug 29, 2008 1:31 am    Post subject: Reply with quote

Apprentice

Joined: 13 Aug 2008
Posts: 34

Maximum file size I can send without any issues is 42KB. I am not sure why this is 42KB.

Please let me know if there is any way to identify the message chunks and update only the first chunk and leave others..!

Or any other information which could help me to resolve this issue.

Your help is much appreciated.
_________________
Sridhar Javagal
Solution design and delivery
Back to top
View user's profile Send private message
javagals
PostPosted: Fri Aug 29, 2008 4:33 am    Post subject: Reply with quote

Apprentice

Joined: 13 Aug 2008
Posts: 34

David,

Thanks for your email with TSB header value at 10th byte. I got it work by checking this value.

I can successfully configure mq security exit to identify and authenitcate users against LDAP server and mq receiver exit to update message header with remote IP and username field for further business use.

Thanks for your help.

Regards,
Sridhar Javagal.
_________________
Sridhar Javagal
Solution design and delivery
Back to top
View user's profile Send private message
David.Partridge
PostPosted: Fri Aug 29, 2008 4:43 am    Post subject: Reply with quote

Master

Joined: 28 Jun 2001
Posts: 249

I'm not quite sure where to start here, as its clear to me from your code fragment that you haven't studied the data buffers that flow on an MQI channel.

For a starter, there will never, ever be an MQXQH on the front of the buffer for an MQI RPC. Here for example is an MQ trace of the start of a data buffer received for an MQPUT:

Code:

 10:23:34.642708   327882.59429      Channel Name:SYSTEM.ADMIN.SVRCONN
 10:23:34.642719   327882.59429      Receiving 560 bytes
 10:23:34.642719   327882.59429        0x0000:  54534820 00000294 01863000 00000000  |TSH ......0.....|
 10:23:34.642719   327882.59429        0x0010:  00000000 00000111 04b80000 00000294  |................|
 10:23:34.642719   327882.59429        0x0020:  00000000 00000000 00000004 4d442020  |............MD  |
 10:23:34.642719   327882.59429        0x0030:  00000002 00000040 00000001 00000bb8  |.......@...... .|
 10:23:34.642719   327882.59429        0x0040:  00000000 00000111 000004b8 4d514144  |............MQAD|
 10:23:34.642719   327882.59429        0x0050:  4d494e20 ffffffff 00000000 00000000  |MIN ............|
 10:23:34.642719   327882.59429        0x0060:  00000000 00000000 00000000 00000000  |................|
 10:23:34.642719   327882.59429        0x0070:  00000000 00000000 00000000 00000000  |................|
 10:23:34.642719   327882.59429        0x0080:  00000000 00000000 00000000 00000000  |................|
 10:23:34.642719   327882.59429        0x0090:  414d512e 4d514558 504c4f52 45522e31  |AMQ.MQEXPLORER.1|
 10:23:34.642719   327882.59429        0x00a0:  33303039 30393435 30202020 20202020  |300909450       |
 10:23:34.642719   327882.59429        0x00b0:  20202020 20202020 20202020 20202020  |                |
 10:23:34.642719   327882.59429        0x00c0:  20202020 20202020 20202020 20202020  |                |
 10:23:34.642719   327882.59429        0x00d0:  20202020 20202020 20202020 20202020  |                |
 10:23:34.642719   327882.59429        0x00e0:  20202020 20202020 20202020 20202020  |                |
 10:23:34.642719   327882.59429        0x00f0:  20202020 20202020 20202020 00000000  |            ....|
 10:23:34.642719   327882.59429        0x0100:  00000000 00000000 00000000 00000000  |................|
 10:23:34.642719   327882.59429        0x0110:  00000000 00000000 00000000 20202020  |............    |
 10:23:34.642719   327882.59429        0x0120:  20202020 20202020 20202020 20202020  |                |
 10:23:34.642719   327882.59429        0x0130:  20202020 20202020 20202020 00000000  |            ....|
 10:23:34.642719   327882.59429        0x0140:  20202020 20202020 20202020 20202020  |                |
 10:23:34.642719   327882.59429        0x0150:  20202020 20202020 20202020 20202020  |                |
 10:23:34.642719   327882.59429        0x0160:  20202020 20202020 20202020 20202020  |                |
 10:23:34.642719   327882.59429        0x0170:  00000000 00000000 00000000 00000000  |................|
 10:23:34.642719   327882.59429        0x0180:  00000000 00000000 00000001 00000000  |................|
 10:23:34.642719   327882.59429        0x0190:  00000000 ffffffff 504d4f20 00000001  |........PMO ....|
 10:23:34.642719   327882.59429        0x01a0:  00000084 ffffffff 00000000 00000000  |................|
 10:23:34.642719   327882.59429        0x01b0:  00000000 00000001 20202020 20202020  |........        |
 10:23:34.642719   327882.59429        0x01c0:  20202020 20202020 20202020 20202020  |                |
 10:23:34.642719   327882.59429        0x01d0:  20202020 20202020 20202020 20202020  |                |
 10:23:34.642719   327882.59429        0x01e0:  20202020 20202020 20202020 20202020  |                |
 10:23:34.642719   327882.59429        0x01f0:  20202020 20202020 20202020 20202020  |                |
 10:23:34.642719   327882.59429        0x0200:  20202020 20202020 20202020 20202020  |                |
 10:23:34.642719   327882.59429        0x0210:  20202020 20202020 00000078


If I remember right (and it's a long while since I looked at this stuff), the TSH is the first x'28' or x'2c' bytes. For sure the MQMD for the MQPUT starts a +x'2c' and the PMO starts at +x'198'.

I suggest you need to do a lot of reverse engineering here if you really want to go down this route, and it will never be easy to support as IBM could change the layout of the buffer at any time (obviously changing the FAP level in the TSH to indicate the new layout is being used).
_________________
Cheers,
David C. Partridge
Back to top
View user's profile Send private message
javagals
PostPosted: Wed Sep 03, 2008 6:25 am    Post subject: Reply with quote

Apprentice

Joined: 13 Aug 2008
Posts: 34

Thanks David & Roger for your help.

I have managed to create receiver exit which extracts userId, format and remote client ip address details and puts it in message header.
_________________
Sridhar Javagal
Solution design and delivery
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » User Exits » Receiver Exit currputs files over 32KB size
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.