in reply to Re: Re: CGI to MSMQ
in thread CGI to MSMQ

Hmm, I don't seem to have a MessageQueue COM Object here, but here's my scratch at it:
use Win32::OLE; my $myQueue = Win32::OLE->new("MessageQueue") or die("Create object failed! :P");
This sets up the object for you. I don't see a way to pass args to the constructor, so you have to set the property for the target queue. Example:
$myQueue->{targetQueue} = "./" . $private . "/myQueue";
Then to send the message it will be so:
$myQueue->Send($messageText);
Note that these are analogs for what happens above, and you'll have to work it together like you want/need. I would have been more help if I had the MessageQueue object, but I'm sure my guesses are quite close.
Also, I'm assuming you know a little about perl or can figure it from the code at hand; declaring variables, subs and such.

hth

Later that day: <mope> nobody ever comes back to tell if it worked :P </mope>

mhoward - at - hattmoward.org

Replies are listed 'Best First'.
Re: Re: Re: Re: CGI to MSMQ
by Anonymous Monk on Jun 16, 2003 at 10:49 UTC
    Sorry for the late reply!

    Unfortunately, I get an error when creating the OLE object. Apparently the object name is wrong or there's no appropriate OLE object..

    Any ideas/advice/code appreciated!

    Anonymous Monk

Re: Re: Re: Re: CGI to MSMQ
by Anonymous Monk on Jun 16, 2003 at 09:00 UTC
    Sorry for the delayed response!

    Unfortunately, I get the error:
    Create object failed! :P

    I'm familiar with cgi and Perl, as well as MS technolgies, but using them together is still tricky..

    As usual, any ideas/code/suggestions welcome!
    Anonymous Monk.

      I can't find a MessageQueue object anywhere! I searched around to find out what .dll contains the object you want, and all I can find is that it is part of System.Messaging.dll in the .NET Framework. The only thing is, I've looked at two servers with .NET 1.1 (& MSMQ) and they don't have it. There is another object that seems related, though, it's MSMQ.MSMQQueue; maybe it can serve your purpose? Microsoft provides all the docs for it at MSDN. Actually, you'll probably want to use the MSMQ objects anyway, so you don't waste the time/memory of firing up a .NET CLR object (yes, they're slower, and yes, I hate them :)

      As a side note, do you have an entry, System.Messaging.MessageQueue, in your registry under HKEY_CLASSES_ROOT?

      HTH

      mhoward - at - hattmoward.org
        Hmm. No System.Messagging.MessageQueue under HKEY_CLASSES_ROOT, but I have had some limited success.

        use Win32::OLE; my $queueInfo = Win32::OLE->new('MSMQ.MSMQQueueInfo'); $queueInfo->{pathname} = '.\private$\foo'; $queueInfo->Create();
        The preceeding code does actually create the queue, so I know that this set of objects exists and functions. Still, I can't send a message! As I mentioned elsewhere, perhaps the problem is that the queue object I receive from calling $queueInfo->Open(2,0) is unblessed?

        Continuing thanks,
        A.M.