.NET client connecting to IBM MQ via SSL

I received key files from our client, where I need to use them to connect to MQ via SSL. Files we received from the client:

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

They said in the customer channel table. I am trying to connect using the code below. And they say that I do not need to specify the queue manager, it will be defined in the table of client channels. But one thing that they did when they created the key using "user1".

The 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(); 

The error I am getting is:

Message = "MQRC_Q_MGR_NAME_ERROR"

I also tried connecting to the server, which I can do.

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

+4
source share
3 answers

I asked a question by installing the following env varibles. before connecting.

Env varibles is 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 up, just call queueManager = new MQQueueManager (); -You must be good.

+4
source

"MQRC_Q_MGR_NAME_ERROR" means that you are successfully connecting to QMgr, but the name QMgr does not match the name in the connection request. For example, if my connection request is for QMGRA, and the IP and port to which I connect are QMGRB, I expect to get the error that you see. If my connection request does not specify the name QMgr, then which QMgr I am connecting to should accept the connection. Therefore, it seems that either the environment variable, or the CCDT file, or the line of code not shown in your question, points to the name QMgr pior for trying to connect. Unfortunately, it is impossible to indicate one of them as a reason without additional information.

Do not worry about the user1 identifier that gave you. If this were a problem, you would return 2035 MQRC_AUTHORIZATION_ERROR back. The identifier is not even verified until a connection can be made.

Here are a few links that can help you figure this out. These are WMQ v7 links. Since v6 is the end of life since September 2011, I hope that all new developments will be on v7. In addition, .NEt classes are integrated into the core WMQ product and are fully supported with v7.

MQCONN Call Examples http://bit.ly/9HG8tC

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

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

+3
source
  • First, you need to enter the key "<add key="NMQ_MQ_LIB" value="mqic32.dll" />" in the settings

  • Place the connection table in the directory.

  • Enter environment variables: MQCHLLIB -> Path to the table directory and MQCHLTAB->Name the table file

  • In C # code, use the MQQueueManager constructor: "MQQueueManager oQueueMng = new MQQueueManager();" . this constructor will find on the CCDT server, channel, etc.

  • In C # code, when you need to open the queue for posting messages, open the queue with the MQOO_BIND_NOT_FIXED option, I will open the MQC.MQOO_OUTPUT + MQC.MQOO_BIND_NOT_FIXED + MQC.MQOO_FAIL_IF_QUIESCING . oQueueMng.AccessQueue("name of the queue", "open options");

0
source

Source: https://habr.com/ru/post/1307280/


All Articles