views:

413

answers:

3

I got key files from our client where I need to use them to connect to MQ over SSL. The files we have got from client are:

xxx.crl 
xxx.kdb 
xxx.rdb 
xxx.sth 
xxx.tab 

They said client channel table in that. I am trying to connect using the below code. And they are saying I don't need to specify the Queue Manager it will be defined in the Client Channel Table. But one thing is they have done while created key with the using "user1".

Code:

Hashtable connectionProperties = new Hashtable(); 

// Add the connection type 
connectionProperties.Add(MQC.TRANSPORT_PROPERTY, connectionType); 

MQQueueManager qMgr; 

MQEnvironment.SSLCipherSpec = "TRIPLE_DES_SHA_US"; 
MQEnvironment.SSLKeyRepository = @"D:\Cert\BB\key"; 
MQEnvironment.UserId = "user1"; 
MQEnvironment.properties.Add(MQC.TRANSPORT_PROPERTY, connectionType); 
qMgr = new MQQueueManager(); 

Error I am getting:

Message = "MQRC_Q_MGR_NAME_ERROR"

I also tried telneting the server which I am able to do.

Can some help me what is wrong I am doing here and why I am getting this error.

A: 

-Firstly you need to put in the appsettings the key "" -Put the conections table in a directory. -Introduce the envioroment variables: MQCHLLIB -> Path to the directory of the table, and MQCHLTAB->Name of the file of the table -In the C# code use the MQQueueManager constructor: "MQQueueManager oQueueMng = new MQQueueManager();". that constructor find in the CCDT the server, channel, etc. -In the C# code, when you need to open a queue to put messages, open the queue whith the option MQOO_BIND_NOT_FIXED, I am opening with the options MQC.MQOO_OUTPUT + MQC.MQOO_BIND_NOT_FIXED + MQC.MQOO_FAIL_IF_QUIESCING. oQueueMng.AccessQueue("name of the queue", "open options");

+2  A: 

The "MQRC_Q_MGR_NAME_ERROR" means that you are successfully connecting to a QMgr but the name of the QMgr does not match the name on the connection request. For example, if my connection request is for QMGRA and the IP and port I connect to are for QMGRB, I would expect to get the error you are seeing. If my connection request does not specify a QMgr name, then whatever QMgr I connect to should accept the connection. Therefore, it seems that either an environment variable, the CCDT file or a line of code not shown in your question is specifying the QMgr name pior to the connection attempt. Unfortunately, it is not possible to point at one of these as the cause without more information.

Don't worry about the user1 ID that you were given. If this were the problem you would have received back 2035 MQRC_AUTHORIZATION_ERROR instead. The ID is not even checked until after the point where your connection failed.

Here are a few links that may help you sort all this out. These are the WMQ v7 links. Since v6 is End-of-Life as of Sept 2011 I would hope that all new development would be on v7. Also, the .NEt classes are integrated into the WMQ base product and fully supported as of v7.

Examples of MQCONN calls http://bit.ly/9HG8tC

Connecting WebSphere MQ client applications to queue managers http://bit.ly/9eapRO

Using SSL with WMQ .Net client http://bit.ly/9nXayP

T.Rob
A: 

I sloved the issue by setting following env varibles. before the connection.

Env varibles are MQCHLLIB,MQCHLTAB,MQSSLKEYR - use Environment.SetEnvironmentVariable - to set values

<add key="MQ_SSL_CERT_PATH" value="D:\Cert\<nameof KDB with out .kdb>" />   
<add key="MQ_CHANNEL_LIB" value="D:\Cert" />  --- Certs location. 
<add key="MQ_CHANNEL_TAB" value="xxx.tab" />
<add key="NMQ_MQ_LIB" value="mqic.dll" />  - **Make sure you give the refarance of this DLL**

After setting all this just call queueManager = new MQQueueManager(); - You should be good.