Author |
Message
|
Thyagu |
Posted: Wed Sep 06, 2006 3:49 am Post subject: Manipulating RFH2 headers in a Java Program |
|
|
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 |
|
 |
jefflowrey |
Posted: Wed Sep 06, 2006 4:20 am Post subject: |
|
|
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 |
|
 |
Thyagu |
Posted: Wed Sep 06, 2006 5:09 am Post subject: |
|
|
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 |
|
 |
jefflowrey |
Posted: Wed Sep 06, 2006 5:12 am Post subject: |
|
|
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 |
|
 |
Thyagu |
Posted: Wed Sep 06, 2006 10:49 pm Post subject: |
|
|
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 |
|
 |
|