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 Java / JMS » Manipulating RFH2 headers in a Java Program

Post new topic  Reply to topic
 Manipulating RFH2 headers in a Java Program « View previous topic :: View next topic » 
Author Message
Thyagu
PostPosted: Wed Sep 06, 2006 3:49 am    Post subject: Manipulating RFH2 headers in a Java Program Reply with quote

Newbie

Joined: 06 Sep 2006
Posts: 3

Hi,

We are currently developing a stub to recieve and post message to an IBM MB based application. The stub should perform the following:

1) Recieve the MQ message from the IBM MB application

2) Extract the RFH2 headers from the incomming message, set it to the response message and post it to the IBM MB application.

We have currently devleoped a program which does the above functionality. But the IBM MB application is not able to process the message created by the stub. Below is the code fragment from our stub program.

ByteArrayOutputStream bstream = new ByteArrayOutputStream();
DataOutputStream ostream = new DataOutputStream (bstream);

String strVariableData = rfh2Header;
int iStrucLength = MQC.MQRFH_STRUC_LENGTH_FIXED_2 +
strVariableData.getBytes().length;
while(iStrucLength % 4 != 0)
{
strVariableData = strVariableData + " ";
iStrucLength = MQC.MQRFH_STRUC_LENGTH_FIXED_2 +
strVariableData.getBytes().length;
}
mqMessage.format = MQC.MQFMT_RF_HEADER_2;

ostream.writeChars(MQC.MQRFH_STRUC_ID);//StrucID
ostream.writeInt(MQC.MQRFH_VERSION_2);//Version
ostream.writeInt(iStrucLength );//StrucLength
ostream.writeInt(MQC.MQENC_NATIVE);//Encoding
ostream.writeInt(MQC.MQCCSI_DEFAULT);//CodedCharSetID
ostream.writeChars(MQC.MQFMT_STRING);//Format
ostream.writeInt(MQC.MQRFH_NO_FLAGS);//Flags
ostream.writeInt(1208);//NameValueCCSID
ostream.writeInt(strVariableData.getBytes().length);//NameValueLength
ostream.writeChars(strVariableData ); //NameValueData
ostream.flush();
byte[] bArr = bstream.toByteArray();

mqMessage.write(bArr);

mqMessage.writeString(responseMessage);

mqQueue.put(mqMessage, aMQPutMessageOptions);


Can anyone help us in this regard?
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Sep 06, 2006 4:20 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

I'm confused.

Are you adding an MQRFH2? Or modifying one?

Also, I assume you have a good reason for not using JMS.

Also, have you tried comparing the binary output of your code with the binary output of a message that "works"?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Thyagu
PostPosted: Wed Sep 06, 2006 5:09 am    Post subject: Reply with quote

Newbie

Joined: 06 Sep 2006
Posts: 3

Our main application is based on IBM Message Broker and we are using MQ Series for our messaging.

The application sets some properties in the RFH2 header which our stub code should copy and append it in the response which is sent to the application. Basically we are storing correlation data in the RFH2 header hence the stub should extract the RFH2 header from the request message and append it in the response message which it is sending to the application.

Hope I am clear
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Sep 06, 2006 5:12 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Ah. Okay.

Why are you doing that in the Stub, rather than in the Broker?

In fact, why do you have a stub at all?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Thyagu
PostPosted: Wed Sep 06, 2006 10:49 pm    Post subject: Reply with quote

Newbie

Joined: 06 Sep 2006
Posts: 3

We are involved in an EAI based project which involves integrating multiple systems.

This particular application has to be performance tested, hence we have written a Java program which will simulate the end system.

The stub cannot be an Broker based application.
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 » IBM MQ Java / JMS » Manipulating RFH2 headers in a Java Program
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.