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 » VB .NET connecting to a remote queue manager on a network.

Post new topic  Reply to topic
 VB .NET connecting to a remote queue manager on a network. « View previous topic :: View next topic » 
Author Message
MCardinal
PostPosted: Wed Oct 06, 2010 11:04 am    Post subject: VB .NET connecting to a remote queue manager on a network. Reply with quote

Novice

Joined: 06 Oct 2010
Posts: 18
Location: Ottawa, Canada

Hi,

I have been looking over many books, pdf and web article in the past days and I hope someone will be able to give me a good answer.

First I'm new with Webpshere and it's development platform. I was hoping to develop an application in VB .NET.

This is the step I can't get through. Connect to a remote queue on a server on my network.

This is my simple code
**************************************************
Imports IBM.WMQ
Imports IBM.WMQ.MQC

Public Class Form1
Private Sub Form1_Loadd(ByVal sender As System.Object, ByVal e as System.EventArgs) Handles MyBase.Load

Try
MQEnvironment.HostName = "Myserver"
MQEnvironment.Port = 1414
MQEnvironment.Channel = "APPLICATION.NET"
MQEnvironment.UserId = "MUSR_MQADMIN"

DIM qmgr As New MQQueueManager("THE.REMOTE.QUEUE")
Catch ex as MQException
MsgBox(ex.Message)
End Try
End Sub
End Class
********************
This code returns error MQRC_Q_MGR_NAME_ERROR as it doesn't find the host or queue at all. Logs on the server doesn't indicate it's trying at all to connect.

If I replace THE.REMOTE.QUEUE with THE.LOCAL.QUEUE it will connect without any problem. I have tested using the same code with a bogus port number and it does connect anyway to my local queue as if it ignores all the MQenvironment parameters except UserId.

I have registered the .Net classes and I'm not sure if I have to install SOAP or something else.

For the sceptics yes it does work and using the C sample all amqscnxc -x MYSERVER -c APPLICATION.NET THE.REMOTE.QUEUE will return Connection established to the queue manager THE.REMOTE.QUEUE

Thanks
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Oct 06, 2010 11:54 am    Post subject: Reply with quote

Grand High Poobah

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

Ok, let's be clear on a few terms:

Local means the queue manager to which you're connected. This queue manager could be a different one to the one on which your application is running. Remote is something on any other queue manager.

A remote queue is a specific object, hosted locally, which points to a queue hosted on a different queue manager and doesn't allow all the functions of a locally hosted object (for instance you can't read a message with an application from a remote queue object).

So to connect to a "remote queue on a server on your network" you either connect to the queue manager that hosts it over the network or get your local queue manager to pass messages for you.

Now queue managers are not typically called "THE.REMOTE.QUEUE", but many queue manager have local queue objects with the same names as other queue managers for reasons explained in the Intercommunication manual. I think it's one of those objects that amqscnxc is connecting to.

So you have 2 options. Stick with your code as written but change the queue manager object to your local queue name & use redirection, or alter the MQEnvironment to reflect where your target lives and connect that way.

Which you use depends on what your application intends to do with the connection and is a design question. Both methods are valid in various scenarios.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
MCardinal
PostPosted: Thu Oct 07, 2010 3:49 am    Post subject: Reply with quote

Novice

Joined: 06 Oct 2010
Posts: 18
Location: Ottawa, Canada

OK let me use different terms, I'm not talking about queues yet. Only Queue manager object.

Local means my computer, remote means another computer or server.

So basicly your reply: "So to connect to a "remote queue on a server on your network" you either connect to the queue manager that hosts it over the network or get your local queue manager to pass messages for you."

This is what I'm trying to accomplish.

From the 2 options you mentionned, the first one I can do no problem but It's not the goal, because the user who wil run the application may only have the Webphere MQ client installed.

If you look at my code I'm trying to modify MQEnvironment object to reflect to my target. This object however doesn't seam to work and I'm wondering why.

Let look back at the code I posted ( I renamed the generic QM )
If I run this code from MYCOMPUTER, ip 192.168.0.2 and that I want to connect to the Queue manager name "THE.REMOTE.QM" on MyServer, ip 192.168.0.3, on port 1414 using the channel APPLICATION.NET .

Why is it that using my code posted previously it doesn't work? But all instance are there on the server, I have connected to that QM many time but not using this code.

What I'm I missing?
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Oct 07, 2010 4:37 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/topic/com.ibm.mq.csqzav.doc/un10480_.htm
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Oct 07, 2010 4:43 am    Post subject: Reply with quote

Grand High Poobah

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

MCardinal wrote:
OK let me use different terms, I'm not talking about queues yet. Only Queue manager object.

Local means my computer, remote means another computer or server.


That's fine, but you'll find my terms are what the WMQ documentation uses for local & remote. Be aware when reading them.

MCardinal wrote:
From the 2 options you mentionned, the first one I can do no problem but It's not the goal, because the user who wil run the application may only have the Webphere MQ client installed.


Only having the client does not prevent you using the 1st option. It's very much the most common pattern to have only a client installed and connect to a queue manager hosted elsewhere via TCP.

MCardinal wrote:
If you look at my code I'm trying to modify MQEnvironment object to reflect to my target. This object however doesn't seam to work and I'm wondering why.


I'm not seeing that.

MCardinal wrote:
What I'm I missing?


I think you're using a binding connection that links to a queue manager running on the same machine as the application rather than a client that uses TCP & the MQEnvironment settings.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
MCardinal
PostPosted: Thu Oct 07, 2010 7:23 am    Post subject: Reply with quote

Novice

Joined: 06 Oct 2010
Posts: 18
Location: Ottawa, Canada

You are right I use a binding connection, but I don't know how not to use it.

Like mentionned in this topic:
http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqzav.doc/un10690_.htm

This generates this error. MQRC_Q_MGR_NOT_AVAILABLE.

Can anyone show me how I can change my binding connection?
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Oct 07, 2010 7:47 am    Post subject: Reply with quote

Grand High Poobah

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

MCardinal wrote:
Can anyone show me how I can change my binding connection?


In that same .NET manual there is a section "Defining which connection type to use" that explains it all.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Oct 07, 2010 8:33 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Vitor wrote:
MCardinal wrote:
Can anyone show me how I can change my binding connection?


In that same .NET manual there is a section "Defining which connection type to use" that explains it all.


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


Back to top
View user's profile Send private message
MCardinal
PostPosted: Thu Oct 07, 2010 8:53 am    Post subject: Reply with quote

Novice

Joined: 06 Oct 2010
Posts: 18
Location: Ottawa, Canada

OH!! thanks all for replying to my post. I figured it out after long research.

The web link post doesn't help much but here it the line of code I was missing.

MQEnvironment.properties.Add(MQC.Transport_Property,MQC.Transport_MQSERIES_CLIENT)

Then it makes the connection. Hope it help others.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » VB .NET connecting to a remote queue manager on a network.
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.