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 IndexUser ExitsC# (.NET) exit issue

Post new topicReply to topic
C# (.NET) exit issue View previous topic :: View next topic
Author Message
RogerLacroix
PostPosted: Thu Feb 07, 2008 9:10 pm Post subject: C# (.NET) exit issue Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3253
Location: London, ON Canada

All,

I'll probably need to open a PMR but I'll take a shot here. My setup is WinXP SP2, WMQ v6.0.2.2 and .NET v2.

I've created a security exit in C# for .NET but it does not run and I get the following messages in the error log:
Quote:
02/07/08 22:47:14 - Process(5420.1) User(rlacroix) Program(MQTest01.exe)
AMQ6188: The system could not dynamically load the library
F:\VS2005\Projects\cwsx\bin\cwsx.dll due to a problem with the dll. The errno
was 536895880. The queue manager will continue without this module.

EXPLANATION:
This message applies to Windows NT and Windows 2000 systems only. The
dynamically loadable file F:\VS2005\Projects\cwsx\bin\cwsx.dll failed to load
correctly due to a problem with the dll.
ACTION:
Check that the dll is in the correct place with the correct file permissions
etc. and has not been corrupted.
----- amqxufnn.c : 596 --------------------------------------------------------
02/07/08 22:47:14 - Process(5420.1) User(rlacroix) Program(MQTest01.exe)
AMQ9535: User exit not valid.

EXPLANATION:
Channel program 'TEST.EXIT' ended because user exit
'F:\VS2005\Projects\cwsx\bin\cwsx.dll(CWSX.mysx)' is not valid.
ACTION:
Ensure that the user exit is specified correctly in the channel definition, and
that the user exit program is correct and available.


The exit is a shell (dummy) exit. i.e.

Code:
using System;
using System.Collections.Generic;
using System.Text;

using IBM.WMQ;

namespace CWSX
{
    public class mysx : MQSecurityExit
    {
        public byte[] SecurityExit(MQChannelExit pCXP, MQChannelDefinition pChDef, byte[] abyte0, ref int dataOffset, ref int dataLength, ref int dataMaxLength)
        {
            pCXP.ExitResponse = MQC.MQXCC_OK;

            return abyte0;
        }
    }
}


And it is compiled as a Library. i.e.
Code:
csc /t:library /r:System.dll /r:"C:\Program Files\IBM\WebSphere MQ\bin\amqmdnet.dll" /out:cwsx.dll mysx.cs


The driver program (MQTest01) works perfectly without the security exit defined but as soon as I define it in the code, I get 2059.

Here's a code snippet:

Code:
MQEnvironment.Hostname = "127.0.0.1";
MQEnvironment.Channel ="TEST.EXIT";
MQEnvironment.Port = 1415;
MQEnvironment.SecurityExit = "F:\\VS2005\\Projects\\cwsx\\bin\\cwsx.dll(CWSX.mysx)";
MQQueueManager _qMgr = new MQQueueManager(qManager);


By no means am I a ".NET" or C# expert, so it could be that I'm missing a flag. Does anybody see a problem with the above code?

Regards,
Roger Lacroix
Capitalware Inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
fjb_saper
PostPosted: Fri Feb 08, 2008 4:15 am Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

Roger,

Looks to me like you could do with a public constructor that is standard??

Or at least make the method static?

I think the problem might be that it will not let you instantiate the class...


_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
RogerLacroix
PostPosted: Mon Feb 11, 2008 1:53 pm Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3253
Location: London, ON Canada

fjb_saper wrote:
Looks to me like you could do with a public constructor that is standard??

Or at least make the method static?

I think the problem might be that it will not let you instantiate the class...

Hi,

I added the Public constructor and it made no difference. When I made the method "public static", I get the following error:
Quote:
mysx.cs(9,18 ): error CS0536: 'CWSX.mysx' does not implement interface member
'IBM.WMQ.MQSecurityExit.SecurityExit(IBM.WMQ.MQChannelExit, IBM.WMQ.MQChannelDefinition, byte[], ref int, ref
int, ref int)'. 'CWSX.mysx.SecurityExit(IBM.WMQ.MQChannelExit, IBM.WMQ.MQChannelDefinition, byte[], ref int
ref int, ref int)' is either static, not public, or has the wrong return type.


The funniest part is if you copy the example verbatim from the WMQ Using .NET manual you get the following error (after you fix the missing commas and add a return statement):
Quote:
MyMQExit.cs(9,10): error CS0536: 'CWSX.MyMQExits' does not implement interface member
'IBM.WMQ.MQSendExit.SendExit(IBM.WMQ.MQChannelExit, IBM.WMQ.MQChannelDefinition, byte[], ref int, ref int, ref
int)'. 'CWSX.MyMQExits.SendExit(IBM.WMQ.MQChannelExit, IBM.WMQ.MQChannelDefinition, byte[], ref int, ref int,
ref int)' is either static, not public, or has the wrong return type.
c:\Program Files\IBM\WebSphere MQ\bin\amqmdnet.dll: (Location of symbol related to previous error)
MyMQExit.cs(12,14): (Location of symbol related to previous error)
MyMQExit.cs(9,10): error CS0536: 'CWSX.MyMQExits' does not implement interface member
'IBM.WMQ.MQReceiveExit.ReceiveExit(IBM.WMQ.MQChannelExit, IBM.WMQ.MQChannelDefinition, byte[], ref int, ref int,
ref int)'. 'CWSX.MyMQExits.ReceiveExit(IBM.WMQ.MQChannelExit, IBM.WMQ.MQChannelDefinition, byte[], ref int, ref
int, ref int)' is either static, not public, or has the wrong return type.
c:\Program Files\IBM\WebSphere MQ\bin\amqmdnet.dll: (Location of symbol related to previous error)
MyMQExit.cs(18,14): (Location of symbol related to previous error)
MyMQExit.cs(9,10): error CS0536: 'CWSX.MyMQExits' does not implement interface member
'IBM.WMQ.MQSecurityExit.SecurityExit(IBM.WMQ.MQChannelExit, IBM.WMQ.MQChannelDefinition, byte[], ref int, ref
int, ref int)'. 'CWSX.MyMQExits.SecurityExit(IBM.WMQ.MQChannelExit, IBM.WMQ.MQChannelDefinition, byte[], ref
int, ref int, ref int)' is either static, not public, or has the wrong return type.
c:\Program Files\IBM\WebSphere MQ\bin\amqmdnet.dll: (Location of symbol related to previous error)
MyMQExit.cs(24,14): (Location of symbol related to previous error)


So, I guess it is time for a PMR.

Regards,
Roger Lacroix
Capitalware Inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
fjb_saper
PostPosted: Mon Feb 11, 2008 3:37 pm Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

Apparently the doc is incomplete.
Looks like your class needs to implement more than one iface with specific user exit characteristics...

Could it be that the doc only describes one of the ifaces at a time???

Can you extrapolate from your java experience in the same area??

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
RogerLacroix
PostPosted: Mon Feb 11, 2008 6:21 pm Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3253
Location: London, ON Canada

Hi,

Actually, no. The manual's description for .NET is pretty much the same as Java.

I have opened several PMRs related to exits over the last 18 months and it all points to lack of testing by IBM before releasing a version of MQ. IBM has shifted or outsourced the MQ testing to another "place".

The reason I say this is because the 1st question I get is that IBM needs my exit code and driver program. I say use your testing program and they reply that they don't any code to test the exit!!!

If I clean up the manual's code, it looks like:
Code:
using System;
using System.Collections.Generic;
using System.Text;

using IBM.WMQ;

namespace CWSX
{
   class MyMQExits : MQSecurityExit
   {
      public byte[] SecurityExit(MQChannelExit channelExitParms,
                                 MQChannelDefinition channelDefParms,
                                 byte[] dataBuffer,
                                 ref int dataOffset,
                                 ref int dataLength,
                                 ref int dataMaxLength)
      {
         return dataBuffer;
      }
   }
}

And it will compile to a Windows DLL using the following command:
Code:
csc /t:library /r:System.dll /r:"C:\Program Files\IBM\WebSphere MQ\bin\amqmdnet.dll" /out:bin\MyMQExit.dll MyMQExit.cs

But the driver program always ends with an RC=2059 if it using the exit (and I get those messages in the error log).

I'm stumped, its time for a PMR (and I have the test exit and driver program all ready to go for IBM).

Regards,
Roger Lacroix
Capitalware Inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
ope
PostPosted: Fri May 02, 2008 4:34 am Post subject: Reply with quote

Newbie

Joined: 02 May 2008
Posts: 6

I have the same issue. Did you get a response to your PMR.


I am trying to use the MQConn security exit sample which limits client connections on a server connection channel.

I set up the SVRCONN the SCYEXIT of the server connection channel to the location of the security exit using SCYEXIT (‘c:wmq\securityExit\me71\maxconn\lib\maxconn(maxconn)’).

I have a .NET client which puts messages on the MAXCONN.TEST.Q through this server connection channel.

I am able to successfully put messages when a security exit is not set on the channel.

When I set the security exit on the channel and set it in the MQ environment of my client to the same location on the server i.e. c:wmq\securityExit\me71\maxconn\lib\maxconn(maxconn), I get a 2059 NOT AUTORIZED mq exception. The client code sets the security exit using the MQ Environment configuration as shown below,

MQEnvironment.Hostname = hostname;
MQEnvironment.Port = port;
MQEnvironment.Channel = channelName;
MQEnvironment.SecurityExit = securityExitPath;
MQEnvironment.SecurityUserData = “c:wmq\securityExit\me71\maxconn\lib\maxconn(maxconn)”;




Any help would be MUCH appreciated
Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Fri May 02, 2008 7:01 pm Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3253
Location: London, ON Canada

Hi,

Your problem has nothing to do with my original problem.

Isn't SupportPAC ME71 a server-side only security exit? Hence, you install / use it on the server-side and not the client-side. You should read its manual.

Regards,
Roger Lacroix
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
ope
PostPosted: Mon May 05, 2008 7:35 pm Post subject: Reply with quote

Newbie

Joined: 02 May 2008
Posts: 6

Your are right, ME71 is a server-side security exit. I have read, understood and implemented the server side security exit. The issue occurs when I configure the server connection channel with the security exit [i.e set SCYEXIT on the server connection channel to (‘c:wmq\securityExit\me71\maxconn\lib\maxconn(maxconn)’). ] and then send a message from my client. This, I do by setting up my MQEnvironment [including the path to the security exit] before connecting to the queue manager.

On doing this, I get a 2059 exception from MQ.

Although you have implemented your own security exit in .NET, the reason I said its the same as your problem is because when you use the exit you also get a 2059.

Have you successfully implemented and used a security exit in MQV6 since your post? Its a new area to me so I might just as well be doing it wrong.

[/i]
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon May 05, 2008 8:06 pm Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

If ME71 is strictly a server side exit it would mean that you should not try to give any exit library client side...

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
ope
PostPosted: Tue May 06, 2008 2:37 am Post subject: Reply with quote

Newbie

Joined: 02 May 2008
Posts: 6

many thanks for your response. I have taken off the client side MQEnvironment configuration and now getting a 2063 error. For test purposes, the MCAUser on the server connection channel is a user who is member of the mqm group. [This isn't ideal, but its just for test purposes]. Any ideas?
Back to top
View user's profile Send private message
ope
PostPosted: Tue May 06, 2008 3:10 am Post subject: Reply with quote

Newbie

Joined: 02 May 2008
Posts: 6

PS: the security exit has been configured to block connections when there are already 4 connections. I get the 2063 error on my first connection.
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexUser ExitsC# (.NET) exit issue
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.