Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IBM MQ messaging automation
#1
Solved: 7 Years, 5 Months, 1 Week ago
Hi All,

Currently I am automating IBM MQ messaging from UFT.For this I am using .net factory instance.

Problem which I am facing in it is given below:

Code:
Set oMQM = DotnetFactory.CreateInstance("IBM.WMQ.MQQueueManager",strMQMDLLPath1)

After passing correct path oMQM cannot be created.Its show empty after execution.

strMQMDLLPath1:It is path of amqmdxcs.dll DLL.



Please find the code below

Code:
Call FN_SEND_MESSAGE_TO_QUEUE("deepak", "WATCH.LIST.REQUEST", "SQACE_QAE", "", "CP_CLIENT","1419","57.253.139.71","C:\Program Files (x86)\IBM\WebSphere MQ Explorer\amqmdnet.dll","C:\Program Files (x86)\IBM\WebSphere MQ Explorer\amqmdxcs.dll")

Function FN_SEND_MESSAGE_TO_QUEUE (strMessage,strMessageQueue,strMQManager,strRemoteMQManager,strChannel,intPort ,strHostName,strMQMDLLPath,strMQMDLLPath1)

Dim oMQEnvironment  
Dim oMQM
Dim oMQC
Dim oMQMessage
Dim oMQQueue
Dim intOpenOptions
Dim QueueDll

Set oMQEnvironment = DotNetFactory.CreateInstance("IBM.WMQ.MQEnvironment",strMQMDLLPath)

'Initize the Environment
'With oMQEnvironment
    oMQEnvironment.HostName = strHostName
    oMQEnvironment.Port = intPort '1414
    oMQEnvironment.Channel = strChannel
'End with

On Error Resume Next
'Create MQ Instatnces
'throws an error when referencing amqmdnet.dll but works with amqmdxcs.dll
'Set oMQM = DotnetFactory.CreateInstance("IBM.WMQ.MQQueueManager",strMQMDLLPath)

'QueueDll = "C:\Program Files (x86)\IBM\WebSphere MQ Explorer\amqmdxcs.dll"
Set oMQM = DotnetFactory.CreateInstance("IBM.WMQ.MQQueueManager",strMQMDLLPath1)

'Check if MQM Connected
If Err.Number <> 0 Then

Reporter.ReportEvent micFail , "Step: Creating MQM Object" , "Unable to Connect to MQ Manager at" & strHostName
'Call FN_REVERT_TO_SELF
ExitTest
End If

Set oMQC = DotnetFactory.CreateInstance("IBM.WMQ.MQC",strMQMDLLPath)
Set oMQMessage = DotnetFactory.CreateInstance("IBM.WMQ.MQMessage",strMQMDLLPath1)
Reply
#2
Solved: 7 Years, 5 Months, 1 Week ago
HI All,

can someone help me with code for pushing XML data to MQ test using QTP / UFT

Thanks
Sunil
Reply
#3
Solved: 7 Years, 5 Months, 1 Week ago
Try this code:

Code:
Dim oMQEnvironment
    Dim oMQM
    Dim oMQC
    Dim oMQMessage
    Dim oMQQueue
    Dim intOpenOptions

'YOUR MQ DETAILS AND MESSAGE

    'strMQMDLLPath = "C:\\Program Files (x86)\\IBM\WebSphere MQ\\bin\\amqmdnet.dll"
    'strHostName= "Host Name"
    'intPort = "Port Number"
    'strChannel ="Channel Name"
    'strMessage ="UFT Test Message"
    'strMQManager = "Quemanager Name"
    'strMessageQueue = "Queue Name"

               
'              Create MQ Instances
               Set oMQC = DotnetFactory.CreateInstance("IBM.WMQ.MQC",strMQMDLLPath)

               'set the properties of the Queue manager
               Set properties = DotNetFactory.CreateInstance("System.Collections.Hashtable")
                properties.Add oMQC.HOST_NAME_PROPERTY, strHostName
                properties.Add oMQC.PORT_PROPERTY, intPort
                properties.Add oMQC.CHANNEL_PROPERTY, strChannel

               'access the queue manager 
               Set oMQM = DotnetFactory.CreateInstance("IBM.WMQ.MQQueueManager",strMQMDLLPath,strMQManager,properties)

    'Check if MQM Connected
    If Err.Number <> 0 Then
        Reporter.ReportEvent micFail , "Step: Creating MQM Object" , "Unable to Connect to MQ Manager at" & strHostName
        'Exit Test
    End If

    Set oMQC = DotnetFactory.CreateInstance("IBM.WMQ.MQC",strMQMDLLPath)
    Set oMQMessage = DotnetFactory.CreateInstance("IBM.WMQ.MQMessage",strMQMDLLPath)

    'Declare Q open options
    intOpenOptions = oMQC.MQOO_OUTPUT or oMQC.MQOO_FAIL_IF_QUIESCING ' 16 + 8192

    'Open the Q to post the messages
    If strRemoteMQManager = "" Then
    Set oMQQueue = oMQM.AccessQueue(strMessageQueue , intOpenOptions)
    Else 
    Set oMQQueue = oMQM.AccessQueue(strMessageQueue , intOpenOptions ,strRemoteMQManager, "","" )
    End If

    'Format Message
    With oMQMessage
    .CharacterSet = 819
    .WriteString(strMessage)
    End with

    'Post Message
   With oMQQueue
  .Put(oMQMessage)
   .Close()
   End With
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)