| Author | 
		  Message
		 | 
		
		  | act | 
		  
		    
			  
				 Posted: Fri Apr 02, 2004 8:37 pm    Post subject: Urgent :  using JMS with dot net | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 02 Apr 2004 Posts: 6
  
  | 
		  
		    
			  
				I am using mq 5.3 with service pack 6 . i like to know how can i send the message created in c# dot net to the jms client application 
 
over the mq series ... any code and help appricated .
 
 
Thanks ,
 
John | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | PeterPotkay | 
		  
		    
			  
				 Posted: Fri Apr 02, 2004 10:05 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Poobah
 
 Joined: 15 May 2001 Posts: 7723
  
  | 
		  
		    
			  
				Your question is to general. Click on the documentation link at the top of this page, and go to the Library Home Page, then select latest mulit platform books.
 
 
Get the .NET one, and the JAVA one, and after reading them, do post any more specific questions you have. Those manuals have sample code. _________________ Peter Potkay
 
Keep Calm and MQ On | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | act | 
		  
		    
			  
				 Posted: Fri Apr 02, 2004 10:54 pm    Post subject: need help | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 02 Apr 2004 Posts: 6
  
  | 
		  
		    
			  
				what i like to know is ... i like to send a message in a the format which is readbale by the JMS client application using C# .net mq libarary . 
 
 
when i see the java mq source example it provides 
 
 
try{
 
      // Create the Factory
 
      mqFact = new MQQueueConnectionFactory();
 
    }catch(Exception e){
 
 
    }
 
    try{
 
      // Set the Bindings and Transport
 
 
      mqFact.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
 
      mqFact.setQueueManager(QMGRNAME);
 
 
String qUri = "queue://" + QMGRNAME + "/" + QUEUE_NAME + "?persistence=2&priority=5" ;
 
      log("Create Queue : " + qUri);
 
      ioQueue = qSession.createQueue(qUri);
 
      log("Create QueueSender : ");
 
      queueSender = qSession.createSender(ioQueue);
 
      log("Created QueueSender : " );
 
      TextMessage outMessage = qSession.createTextMessage();
 
      log("Created TextMessage");
 
      outMessage.setStringProperty("MessageName","SHIPPING_NOTIFICATION");
 
      outMessage.setStringProperty("RequestingNode","NZP_MK_SHIP");
 
      outMessage.setStringProperty("FinalDestinationNode","");
 
      outMessage.setStringProperty("DestinationNode","");
 
      outMessage.setStringProperty("Password","");
 
      outMessage.setStringProperty("SubChannel","");
 
      outMessage.setBooleanProperty("ReplyTo",false);
 
      /* Get The XML Message */
 
 
      String xmlMessage = readXmlMessage();
 
 
      outMessage.setText(xmlMessage);
 
 
 
and i dont see any examples in dotnet which talks about formatting the RFH2 headers for JMS and sending a message so that jms client application can read it . 
 
 
  i tried to send make a message similar to one sent by java program but jms client application faiuled to read the message 
 
 
  / MQRFH2 Constants
 
			const string MQRFH_STRUC_ID             = "RFH ";
 
			const int    MQRFH_VERSION_2            = 2;
 
			const int    MQRFH_STRUC_LENGTH_FIXED_2 = 36;
 
			const int    MQRFH_NO_FLAGS             = 0;
 
 
			// MCD Folder 
 
			string mcdFolder = "<mcd>" +
 
				"<Msd>jms_text</Msd>" +
 
				"</mcd>";
 
 
 
// User Folder
 
			string usrFolder = "<usr>" +
 
				"<FinalDestinationNode>NULL</FinalDestinationNode>" +
 
				"<OrigTimeStamp>" + DateTime.Now.ToShortDateString() + "T" + DateTime.Now.ToShortTimeString() +"<OrigTimeStamp>" +
 
				"<DestinationNode></DestinationNode>" +
 
				"<MessageName>" + msgName + "</MessageName>" +
 
				"<Password></Password>" +
 
				"<version>></version>" + 
 
				"<ReplyTo>false</ReplyTo>" +
 
				"<RequestingNode>" + reqNode + "</RequestingNode>" +
 
				"<SubChannel></SubChannel>" +
 
				"</usr>";
 
 
			int usrPaddedLength = ((usrFolder.Length - 1) / 4) * 4 + 4;
 
			usrFolder += "    ";
 
			usrFolder = usrFolder.Substring(0, usrPaddedLength);
 
					    
 
			mqMsg.Format = MQC.MQFMT_RF_HEADER_2;
 
		
 
			mqMsg.CharacterSet = 437;
 
 
 
			
 
			mqMsg.WriteString(MQRFH_STRUC_ID);
 
			mqMsg.WriteInt4(MQRFH_VERSION_2);
 
			mqMsg.WriteInt4(MQRFH_STRUC_LENGTH_FIXED_2 + mcdFolder.Length + jmsFolder.Length + usrFolder.Length + 12);
 
			mqMsg.WriteInt4(MQC.MQENC_NATIVE);
 
 
 
but this failes .
 
 
any example which shows how to foramt a message in dot net a nd set the mq header  RFH2  and JMS property so that it can be read by the jms client . appricated .
 
 
Thanks in advanace | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | PeterPotkay | 
		  
		    
			  
				 Posted: Sat Apr 03, 2004 7:46 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Poobah
 
 Joined: 15 May 2001 Posts: 7723
  
  | 
		  
		    
			  
				The JMS client can pick up a message without an RFH2 header. So unless you specifically want the .NET app to build the RFH2 header, don't. Just send a regular MQ message from .NET to the JMS app. It will work just fine.
 
 
Read Chapeter 12 of the Java Manual for MQ. Its all about how the RFH2 header and the MQMD is mapped to JMS clients. There is a section on how it works when a message without a RFH2 header arrives at a JMS app. _________________ Peter Potkay
 
Keep Calm and MQ On | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | act | 
		  
		    
			  
				 Posted: Sat Apr 03, 2004 12:35 pm    Post subject: need help | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 02 Apr 2004 Posts: 6
  
  | 
		  
		    
			  
				the reason i need to pass RFH2 header is ... the JMS client application is a "People Soft"  and it seraches for all the variable potion of the header <mcd> <user> etc from the message . and as in the code i am passing it it cant read those . i think may be bcz of some settings i am doing wrong . 
 
 
   but when i do it in java "people soft" (jms client)  reads it properly . so i need a example which sets the header RFh2 and variable potion of the header using MQ .NET  libery ... can u please provide me the small code snapshot of the example .
 
 
  as IBM help doesn't provide any information on how to set headers for the message for .NET 
 
 
Thanks in advance | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | jefflowrey | 
		  
		    
			  
				 Posted: Sat Apr 03, 2004 1:38 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Poobah
 
 Joined: 16 Oct 2002 Posts: 19981
  
  | 
		  
		    
			  
				You should use something that will let you dump a copy of the message into a file, like amqsbcg or MQ Visual Edit , and compare the messages created by your .Net program and the JMS client.  
 
 
You probably are forgetting to set one of the MQMD formats properly, or getting the byte counts of the static RFH fields wrong, so that they aren't properly parseable by JMS. _________________ I am *not* the model of the modern major general. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | act | 
		  
		    
			  
				 Posted: Sat Apr 03, 2004 2:48 pm    Post subject: need help | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 02 Apr 2004 Posts: 6
  
  | 
		  
		    
			  
				basically i am not understanding how to set a header in the message . 
 
 
when i ma setting the RFH2 constansts and <usr> <mcd> etc on the 
 
 
MQMessage object they are considered as a part of the message . and not as a seprate header then the message .
 
 
where as in Java , jms . the message doesnt incude the header . header is totally different . 
 
 
i am confused with the things any help on basics of setting a header using mq .net is appricated .
 
 
Thanks in advance | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | jefflowrey | 
		  
		    
			  
				 Posted: Sat Apr 03, 2004 4:07 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Poobah
 
 Joined: 16 Oct 2002 Posts: 19981
  
  | 
		  
		    
			  
				Like I said, if you dump the message from the JMS system into a file, and then look at it with an editor, it may help. 
 
 
But really, the only header that is actually a physical header (for the most part) is the MQMD.  The MQRFH2 and other headers are actually inserted into the message buffer, and the MQMD (and each additional header) is adjusted to indicate that there are additional headers. _________________ I am *not* the model of the modern major general. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | act | 
		  
		    
			  
				 Posted: Sat Apr 03, 2004 4:28 pm    Post subject: help required | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 02 Apr 2004 Posts: 6
  
  | 
		  
		    
			  
				i am sending one simple data message <test>this is test</test> one through Java application and another through .NET both are totally different .
 
 
Java Output --
 
 
Create Queue : queue://QM_daywalker/PO.ACTUALRCPT?persistence=2&priority=5
 
Create QueueBrowser :
 
Created QueueBrowser :
 
Message Received = '<test>this is the test xml message</test>'
 
Complete Message Format = '
 
JMS Message class: jms_text
 
  JMSType:         null
 
  JMSDeliveryMode: 2
 
  JMSExpiration:   0
 
  JMSPriority:     5
 
  JMSMessageID:    ID:414d5120514d5f64617977616c6b6572e8e76c4020000401
 
  JMSTimestamp:    1081030437480
 
  JMSCorrelationID:null
 
  JMSDestination:  queue://QM_daywalker/PO.ACTUALRCPT?priority=5&persistence=2
 
  JMSReplyTo:      null
 
  JMSRedelivered:  false
 
  JMSXDeliveryCount:1
 
  FinalDestinationNode:
 
  JMS_IBM_MsgType:8
 
  JMSXAppID:Websphere MQ Client for Java
 
  SubChannel:
 
  MessageName:SHIPPING_NOTIFICATION
 
  JMS_IBM_Format:MQSTR
 
  JMS_IBM_PutApplType:28
 
  DestinationNode:
 
  Password:
 
  JMSXUserID:sushilk
 
  ReplyTo:false
 
  RequestingNode:NZP_MK_SHIP
 
  JMS_IBM_PutTime:22135749
 
  JMS_IBM_PutDate:20040403
 
<test>this is the test xml message</test>'
 
 
 
output from .NET -------
 
Starting the Connection
 
Create Queue : queue://QM_daywalker/PO.ACTUALRCPT?persistence=2&priority=5
 
Create QueueBrowser :
 
Created QueueBrowser :
 
Message Received = 'RFH ☻   ↑☻  "☻                  ?♦      <mcd><Msd>jms_text</Msd></mcd>  Ω   <jms><Dst>queue://QM_daywalker/PO.ACTUALRCPT?priority=5&persist
 
ence=2</Dst><Tms>1081074882440</Tms><Pri>5</Pri><Dlv>2</Dlv></jms>   @☺  <usr><FinalDestinationNode></FinalDestinationNode><OrigTimeStamp>4/4/2004T10:34 AM<OrigTim
 
eStamp><DestinationNode></DestinationNode><MessageName>SHIPPING_NOTIFICATION</MessageName><Password></Password><version>></version><ReplyTo>false</ReplyTo><Request
 
ingNode>NZP_MK_SHIP</RequestingNode><SubChannel></SubChannel></usr><Test>this is the test message</Test>'
 
Complete Message Format = '
 
JMS Message class: jms_text
 
  JMSType:         null
 
  JMSDeliveryMode: 1
 
  JMSExpiration:   0
 
  JMSPriority:     0
 
  JMSMessageID:    ID:414d5120514d5f64617977616c6b6572e8e76c4020000601
 
  JMSTimestamp:    1081031682490
 
  JMSCorrelationID:null
 
  JMSDestination:  null
 
  JMSReplyTo:      null
 
  JMSRedelivered:  false
 
  JMS_IBM_PutDate:20040403
 
  JMSXAppID:estJMS\bin\Debug\TestJMS.exe
 
  JMS_IBM_Format:MQSTR
 
  JMS_IBM_PutApplType:11
 
  JMS_IBM_MsgType:8
 
  JMSXUserID:sushilk
 
  JMS_IBM_PutTime:22344249
 
  JMSXDeliveryCount:1
 
RFH ☻   ↑☻  "☻                  ?♦      <mcd><Msd>jms_text</Msd></mcd>  Ω   <jms><Dst>queue://QM_day
 
Another 473 character(s) omitted'
 
 
 
when u compare both the outputs . in java case those <mcd> <usr> things dont apperatr in output message . where as in .net they become a part of the message . in dot net libarary for mq there is no class for accessing   factory Object which is used by Java application when its senmding message to a "peoplesoft" JMS Client . 
 
 
need input .
 
 
Thanks | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | jefflowrey | 
		  
		    
			  
				 Posted: Sat Apr 03, 2004 4:55 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Poobah
 
 Joined: 16 Oct 2002 Posts: 19981
  
  | 
		  
		    
			  
				The java application is either not writing to a destination of type "JMS", or is not showing you the full message data.
 
 
If you use a different tool than either JMS or .Net to read the message, you will see something useful I think.  Try using the presupplied queue browsing sample program called amqsbcg. _________________ I am *not* the model of the modern major general. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | act | 
		  
		    
			  
				 Posted: Sat Apr 03, 2004 5:01 pm    Post subject: help required | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 02 Apr 2004 Posts: 6
  
  | 
		  
		    
			  
				if u look at the above two messages . the java sending application sets the properties like 
 
 
JMSReplyTo: null 
 
JMSRedelivered: false 
 
JMSXDeliveryCount:1 
 
FinalDestinationNode: 
 
JMS_IBM_MsgType:8 
 
JMSXAppID:Websphere MQ Client for Java 
 
SubChannel: 
 
MessageName:SHIPPING_NOTIFICATION 
 
JMS_IBM_Format:MQSTR 
 
JMS_IBM_PutApplType:28 
 
DestinationNode: 
 
Password: 
 
JMSXUserID:sushilk 
 
ReplyTo:false 
 
RequestingNode:NZP_MK_SHIP 
 
 
 
which are missing in Dot nET one . can u please tell me how to access the properties of  JMS  which are above from .net  libarray .
 
 
as i dont see anything in dot net library which provides methods to access or set the properties like the one baove ... 
 
 
that is what is required so that people soft (jms client) application can undertsand the message .
 
 
as i am not able to access those properties or add custom properites in dot net i am getting different output . 
 
 
the output i shown above is taken from same application . | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | bower5932 | 
		  
		    
			  
				 Posted: Sat Apr 03, 2004 5:55 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Knight
 
 Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA 
  | 
		  
		    
			  
				| Most of the JMS fields that you refer to are kept in the MQMD of the message.  Check out chapter 12 on mapping of MQMD fields to the RFH2 header for JMS.  And as Jeff pointed out, use amqsbcg to look at your message.  Dumping the message from java doesn't tell you what is in the message from an MQ stand-point which is what your .NET program will be looking at. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |