Author |
Message
|
Stalin |
Posted: Tue Dec 01, 2009 3:30 am Post subject: Problem with Reading the MQ Message |
|
|
Novice
Joined: 21 Oct 2009 Posts: 19
|
We are accessing the MQ server installed on the solaris system from the Windows system.
We have made the connection through the Managed connection using .NET.
Below is our code,
Dim mqGetMsgOpts As MQGetMessageOptions
mqMsg = New MQMessage
mqGetMsgOpts = New MQGetMessageOptions
mqGetMsgOpts.WaitInterval = 15000
Try
MQQueue.Get(mqMsg, mqGetMsgOpts)
Dim bMessage(mqMsg.MessageLength - 1) As Byte
bMessage = mqMsg.ReadBytes(mqMsg.MessageLength)
Dim strXML as string
strXML= System.Text.Encoding.UTF8.GetString(bMessage)
End Try
If we display the strXML variable, we could only get the RFH as the message.
No other data.
Is there anything wrong in this method? It seems to be only part of the content or header is returning.
Could you please let me know, What needs to be done to fetch the whole content of the message from MQ server?
Thanks for all your time.
Adavnce Thanks & Regards,
Stalin |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Dec 01, 2009 3:51 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
What separates the RFH header from the main body of the message?
What would that getString method do with that separator?
Where can you find out how long the RFH header is, so you can skip or remove it? |
|
Back to top |
|
 |
Stalin |
Posted: Tue Dec 01, 2009 3:58 am Post subject: |
|
|
Novice
Joined: 21 Oct 2009 Posts: 19
|
Thanks mqjeff for your time.
I am not aware of the RFH Header. I would like to read the whole content using the above code.
Eventhough there is the XML content in the Queue, it is returning only the string "RFH".
Am i missing anything in the code to fetch the whole content.
Adavnce Thanks & Regards,
Stalin |
|
Back to top |
|
 |
Vitor |
Posted: Tue Dec 01, 2009 5:51 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Stalin wrote: |
Am i missing anything in the code to fetch the whole content. |
Bearing uppermost in your mind my rather dubious .NET skills, what happens if the byte array contains an end of string marker somewhere before the end of the message? Like somewhere in, or at the end of, the header?
You either need to use XMS to handle the message (which handles the RFH) or tell the sending application not to include it. I imagine the sending app is using JMS? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Stalin |
Posted: Tue Dec 01, 2009 5:57 am Post subject: |
|
|
Novice
Joined: 21 Oct 2009 Posts: 19
|
Yes Vitor. You are correct. It seems to be our supplier's are using the JMS to write the messages into the queue.
Could you provide me some more info on XMS to handle the messages.
Meanwhile i will also look in to the manuals.
Advance thanks & Regards,
Stalin |
|
Back to top |
|
 |
Vitor |
Posted: Tue Dec 01, 2009 6:14 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Stalin wrote: |
Could you provide me some more info on XMS to handle the messages. |
XMS is a support pac (built into WMQv7? Anyone? Did I dream that?) that provides JMS functionality to non-Java languages. This includes the manipulation of the JMS headers (handled internally by WMQ as the RFH2). _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
shashikanth_in |
Posted: Wed Dec 02, 2009 7:17 pm Post subject: |
|
|
Centurion
Joined: 26 Feb 2009 Posts: 123
|
|
Back to top |
|
 |
Vitor |
Posted: Wed Dec 02, 2009 7:34 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
shashikanth_in wrote: |
XMS.NET 2.0 is now part of MQ and is available with MQ 7.0.1. It can also be downloaded from XMS site but bear in mind that MQ 7.0.1 client libraries is a pre-requisite. |
Thank you!
It's nice to know I'm not imagining this stuff. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Stalin |
Posted: Thu Dec 03, 2009 12:23 am Post subject: |
|
|
Novice
Joined: 21 Oct 2009 Posts: 19
|
Thanks for link and info.
Our Environment
Operating system : Windows XP/Windows 2003
MQ client : MQ client version 6
Application : ASP.NET 1.1
Our Supplier Systems Queue:
<?xml version="1.0" encoding="UTF-8" ?>
<PipPurchaseOrderConfirmation>
<ns0:FromRole>
<ns0:PartnerRoleDescription>
<ns0:RegionCode>AI</ns0:RegionCode>
</ns0:PartnerRoleDescription>
</ns0:FromRole>
</PipPurchaseOrderConfirmation>
We would like to read the above message from the queue.
But using the below code it is returning only the string "RFH".
Dim mqGetMsgOpts As MQGetMessageOptions
mqMsg = New MQMessage
mqGetMsgOpts = New MQGetMessageOptions
mqGetMsgOpts.WaitInterval = 15000
Try
MQQueue.Get(mqMsg, mqGetMsgOpts)
Dim bMessage(mqMsg.MessageLength - 1) As Byte
bMessage = mqMsg.ReadBytes(mqMsg.MessageLength)
Dim strXML as string
strXML= System.Text.Encoding.UTF8.GetString(bMessage)
End Try
Do we realy need to install MQ client version 7.0(XMS Package) to get the full message.
Advance thanks & Regards,
Stalin |
|
Back to top |
|
 |
zpat |
Posted: Thu Dec 03, 2009 1:25 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
To perform a MQGET with WAIT, it's necessary to set both the wait interval and the flag MQGMO_WAIT in the get message options.
Other useful GMOs are MQGMO_CONVERT and MQGMO_FAIL_IF_QUIESCING
Not using convert on MQGET means that your integration design is not cross-platform compatible, which removes one the major benefits of using WMQ. For historic reasons this option is not set on by default (but I would suggest always using it). |
|
Back to top |
|
 |
mvic |
Posted: Thu Dec 03, 2009 3:40 am Post subject: |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
Stalin wrote: |
Do we realy need to install MQ client version 7.0(XMS Package) to get the full message. |
No, it is possible to get this message using any MQ API you choose. But it might be a lot quicker if you use XMS.
If it is a problem to install the XMS code as per the above, discuss this with your IBM account reps. If you have a requirement to work in a different way, then this can be raised formally as a "Requirement" with IBM. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Dec 03, 2009 6:26 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Stalin wrote: |
Do we realy need to install MQ client version 7.0(XMS Package) to get the full message. |
If you're not using XMS then your .NET needs to duplicate the functionality provided and handle the additional JMS header on the front of the message.
So if you feel reinventing the wheel is easier than installing the provided solution go for it! _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Dec 04, 2009 3:34 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Stalin wrote: |
Do we realy need to install MQ client version 7.0(XMS Package) to get the full message. |
No but you need to understand enough about message handling and message headers to at least ditch the RFH.
The other possibility would be to ask the other party to send the message in MQ mode and not JMS mode. This can be achieved with a JNDI setting on the destination or by changing slightly the URI.
See the number of posts about targetClient in the forum.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|