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 » Put Message with RFH2 Header in MQ from VB.NET

Post new topic  Reply to topic Goto page 1, 2  Next
 Put Message with RFH2 Header in MQ from VB.NET « View previous topic :: View next topic » 
Author Message
sarovaithi
PostPosted: Tue May 03, 2011 12:15 pm    Post subject: Put Message with RFH2 Header in MQ from VB.NET Reply with quote

Newbie

Joined: 03 May 2011
Posts: 5

Hi,
I am having an issue with putting data in the usr folder in MQ from VB.Net application.
I having no problem puting the messages, the body of the message going correctly, i am trying to put some data in the usr folder, but when i browse the message using rfhutilc all RFH2 folders appaers in the "message data" not in usr tab.
Can anyonle please help me on this?
My sample code is below:
--------------------------------------------------------------------------
Imports IBM.WMQ
'Imports IBM.WMQSOAP
'Imports IBM.XMS
Dim strUsr As String = "<msgtype>TestMsgType</msgtype>"
Dim strUSRBytes As Byte() = System.Text.Encoding.ASCII.GetBytes(strUsr)
Dim iMsgLen As Integer = (CInt((strUsr.Length)))
PutMsg = New MQMessage

PutMsg.Format = MQC.MQFMT_RF_HEADER_2

PutMsg.WriteString(MQC.MQRFH_STRUC_ID) ' StrucID
PutMsg.WriteInt4(MQC.MQRFH_VERSION_2) ' Version
PutMsg.WriteInt4(MQC.MQRFH_STRUC_LENGTH_FIXED_2 + iMsgLen) ' StrucLength
PutMsg.WriteInt4(MQC.MQENC_NATIVE) ' Encoding
PutMsg.WriteInt4(MQC.MQCCSI_DEFAULT) ' CodedCharSetID
PutMsg.WriteString(MQC.MQFMT_RF_HEADER_2) ' Format
PutMsg.WriteInt4(MQC.MQRFH_NO_FLAGS) ' Flags
PutMsg.WriteInt4(1208) ' NameValueCCSID
PutMsg.WriteInt4(iMsgLen) 'NameValueLength <jms>
PutMsg.WriteString(strUsr) ' NameValueData <usr>

MESSAGE = "<?xml version=""1.0"" encoding=""UTF-8""?><AAA><BBB>TEST</BBB></AAA>"
PutOptions = New MQPutMessageOptions()
PutMsg.WriteString(MESSAGE)
putmsg.Write(
Queue.Put(PutMsg, PutOptions)
--------------------------------------------------------------------------------
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue May 03, 2011 12:18 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Moving to more appropriate forum.
If you are using an RFH header you'd be better advised to use XMS than try building your own. There is the little problem of alignment etc...

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
sarovaithi
PostPosted: Tue May 03, 2011 12:32 pm    Post subject: Reply with quote

Newbie

Joined: 03 May 2011
Posts: 5

I have triet to use XMS...but i dont have any idea how to use that API...Does anybody have some sample code?

Regards,
Saro
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue May 03, 2011 12:34 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

sarovaithi wrote:
I have triet to use XMS...but i dont have any idea how to use that API...Does anybody have some sample code?

Regards,
Saro

Look up on the net an exemple of JMS. XMS is nothing else but JMS ported to a non Java environment...

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mvic
PostPosted: Tue May 03, 2011 12:48 pm    Post subject: Reply with quote

Jedi

Joined: 09 Mar 2004
Posts: 2080

There is a properties interface on the .NET classes in MQ v7.

http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/topic/com.ibm.mq.csqzav.doc/un10920_.htm

You can use XMS if you want, but I think if you just need properties then the .NET classes should offer that. That's if I understood the link above, anyway.
Back to top
View user's profile Send private message
shashikanth_in
PostPosted: Tue May 03, 2011 7:57 pm    Post subject: Reply with quote

Centurion

Joined: 26 Feb 2009
Posts: 123

I believe you are trying to set some user properties. Have you tried using methods like SetIntProperty(), SetStringProperty() of MQMessage class? These methods can be used to set user defined properties.

For example:

Try
msg = New MQMessage()
msg.WriteUTF("This is a test message from VB app with properties")
msg.SetStringProperty("MyProp", "value")
q.Put(msg)
Catch ex As Exception
Console.Write(ex)
End Try
Back to top
View user's profile Send private message
shashikanth_in
PostPosted: Tue May 03, 2011 7:58 pm    Post subject: Reply with quote

Centurion

Joined: 26 Feb 2009
Posts: 123

Adding my update above: I use MQ v7.
Back to top
View user's profile Send private message
sarovaithi
PostPosted: Wed May 04, 2011 5:22 am    Post subject: Reply with quote

Newbie

Joined: 03 May 2011
Posts: 5

Thanks a lot. Now it works fine. Now I am able to see the value in usr folder. Thanks for your help.

Regards,
V. Saro
Back to top
View user's profile Send private message
sarovaithi
PostPosted: Fri May 06, 2011 5:22 am    Post subject: Reply with quote

Newbie

Joined: 03 May 2011
Posts: 5

Now i am able to put value into the USR folder. Now I have one small issue there. I am trying to put a below value into the usr folder.
<Test>Test Message</Test>
When i check the message in USR folder throught RFHUtil, it shows as below
<Test dt="string">Test Message</Test>.
Is there anyway to eliminate dt="string" from that tag?
Back to top
View user's profile Send private message
mvic
PostPosted: Fri May 06, 2011 5:34 am    Post subject: Reply with quote

Jedi

Joined: 09 Mar 2004
Posts: 2080

sarovaithi wrote:
Is there anyway to eliminate dt="string" from that tag?

I think the answer is probably "no".

Out of interest, why do you need to eliminate it?
Back to top
View user's profile Send private message
sarovaithi
PostPosted: Fri May 06, 2011 6:05 am    Post subject: Reply with quote

Newbie

Joined: 03 May 2011
Posts: 5

We are putting messges there and the other team read that message and do further process.
I have asked the same question to that team, no answer from them. They keep on ask us that can we send without that element dt="string"
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri May 06, 2011 6:07 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

sarovaithi wrote:
They keep on ask us that can we send without that element dt="string"


Strictly speaking it's an attribute not an element, which is why it shouldn't make any difference. Except to help a well-behaved recieving application.

I agree with my most worthy associate that there's probably nothing you can do.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mvic
PostPosted: Fri May 06, 2011 6:18 am    Post subject: Reply with quote

Jedi

Joined: 09 Mar 2004
Posts: 2080

sarovaithi wrote:
They keep on ask us that can we send without that element dt="string"

Maybe they would like to say the reason.

I think the dt="string" is there because it is intended to be useful. If it is missing, something else might break when you least expect it.

Are they using some incompatible libraries for parsing messages? Maybe (just my opinion) when you are originating a message using MQ-provided classes, it should be consumed using MQ-provided classes too, to give greatest chance of success.
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri May 06, 2011 6:25 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

mvic wrote:
I think the dt="string" is there because it is intended to be useful.


AFAIK it's intended to describe the datatype of the content for casting & conversion purposes.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
WMBDEV1
PostPosted: Fri May 06, 2011 7:04 am    Post subject: Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

Vitor wrote:
mvic wrote:
I think the dt="string" is there because it is intended to be useful.


AFAIK it's intended to describe the datatype of the content for casting & conversion purposes.




I think that if this attribute isnt present then the data is assumed to be a string (I certainly dont remember dt="string" all over the elements in the usr folder when using JMS).

Its probably that the XMS API is adding it in to be nice, I dont know if theres a way to disable it however and as you say, theres probably no need.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » IBM MQ API Support » Put Message with RFH2 Header in MQ from VB.NET
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.