|   | 
	 
  
    | 
RSS Feed - WebSphere MQ Support
 | 
RSS Feed - Message Broker Support
 |   
 
  
	     | 
	 | 
   
 
  
	|  OAM and .NET | 
	« View previous topic :: View next topic »  | 
   
  
  	
	  
		
		
		  | Author | 
		  Message
		 |  
		
		  | RNStanich | 
		  
		    
			  
				 Posted: Wed Jul 23, 2008 11:42 am    Post subject: OAM and .NET | 
				     | 
			   
			 
		   | 
		 
		
		   Acolyte
 
 Joined: 23 Apr 2002 Posts: 64
  
  | 
		  
		    
			  
				Hi all, bottom line for code gurus.  Is there anything in the code below that would make MQ think this is a destructive get versus a browse?  Browsing is the intent?  Unfortunately for users with just "browse, dsp, and inquire" access the qmgr is calling an error indicating "get" is required.  This is an ASP.NET web application that runs under IIS 6. The web application is set to impersonate the requestor.
 
 
*****
 
Public Shared Function GetMessages(ByVal MQHostName As String, ByVal MQChan As String, ByVal QMgrName As String, ByVal QName As String, Optional ByVal MsgID As Byte() = Nothing, Optional ByVal isPartial As Boolean = False) As Collections.Generic.List(Of SuspendedMsg)
 
        Dim qMgr As MQQueueManager = Nothing
 
        Dim Messages As Collections.Generic.List(Of SuspendedMsg)
 
        Try
 
            qMgr = GetQueueManager(QMgrName, MQHostName, MQChan)
 
            Dim q As MQQueue
 
            Dim m As MQMessage
 
            q = qMgr.AccessQueue(QName, MQC.MQOO_BROWSE Or MQC.MQOO_INPUT_SHARED Or MQC.MQOO_INQUIRE)
 
            Dim gmo As New MQGetMessageOptions
 
            gmo.Options = MQC.MQGMO_BROWSE_FIRST
 
            Messages = New Collections.Generic.List(Of SuspendedMsg)
 
            Dim sm As SuspendedMsg
 
            Dim done As Boolean
 
            Do
 
                Try
 
                    m = New MQMessage
 
                    m.Format = MQC.MQFMT_STRING
 
                    If Not MsgID Is Nothing Then
 
                        m.MessageId = MsgID
 
                        gmo.MatchOptions = MQC.MQMO_MATCH_MSG_ID
 
                    End If
 
                    m.CharacterSet = IBM.WMQ.MQC.CODESET_UTF
 
 
                    q.Get(m, gmo)
 
 
                    sm = New SuspendedMsg(MQHostName, MQChan, QMgrName, QName, m.MessageId, m, isPartial)
 
                    Messages.Add(sm)
 
                    gmo.Options = MQC.MQGMO_BROWSE_NEXT
 
                Catch mx As MQException
 
                    If mx.Reason = MQC.MQRC_NO_MSG_AVAILABLE Then
 
                        done = True
 
                    Else
 
                        Throw mx
 
                    End If
 
                Catch ex As Exception
 
                    System.Diagnostics.Debug.WriteLine(ex.ToString)
 
                    Throw ex
 
                End Try
 
            Loop Until done
 
            If Messages.Count < 1 Then
 
                Throw New ViewSuspMsgException("No messages in queue.")
 
            End If
 
        Finally
 
            If Not qMgr Is Nothing Then
 
                qMgr.Disconnect()
 
            End If
 
        End Try
 
        Return Messages
 
    End Function _________________ Regards, Bob | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | zpat | 
		  
		    
			  
				 Posted: Wed Jul 23, 2008 11:29 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		    Jedi Council
 
 Joined: 19 May 2001 Posts: 5867 Location: UK 
  | 
		  
		    
			  
				| Opening the queue just for browse (rather than browse and input_shared and inquire) should do the trick... | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | RNStanich | 
		  
		    
			  
				 Posted: Thu Jul 24, 2008 8:14 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		   Acolyte
 
 Joined: 23 Apr 2002 Posts: 64
  
  | 
		  
		    
			  
				Thank you, removing the input_shared did the trick. _________________ Regards, Bob | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | 
		    
		   | 
		 
	   
	 | 
   
 
  
	     | 
	 | 
	Page 1 of 1 | 
   
 
 
 
  
  	
	  
		
		  
 
  | 
		  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
  | 
  		 
	   
	 | 
   
 
  	 | 
	  |