Communication Component and integration without

StyvieStyvie Member Posts: 77
Hi,

I am trying to integrate some web server process into Navision using MSMQ and trying to use ComCom2 to do it.

The problem I am having is that VBScript uses Unicode strings (with 00 hex) every second character. Hence Instream.READ or InStream.READTEXT break and assume InStream.EOS is true, despite more characters being in the Message.

I have tried to use ComCom2 on the WebServer , but cannot get the webserver to create instances on ComCom2 , either the Communication Component, or the MSQBusAdapter.

I have even tried to copy the Visual basic example in Navision but only have Visual Studio .NET.

The following code is as close as I can get it,

Dim cc2
Dim mqBA
Dim outMsg
Dim Dom
Dim inMsg
Dim ResponseText

cc2 = New NSCOMCOM2Lib.CommunicationComponent()
mqBA = New MSMQBUSADAPTERLib.MSMQBusAdapter()
Dom = New MSXML2.DOMDocument30()

cc2.AddBusAdapter(mqBA, 1)

mqBA.OpenWriteQueue(".\private$\toNavision", 0, 0)
mqBA.OpenReplyQueue(".\private$\ReplyQueue", 0, 0)

outMsg = cc2.CreateoutMessage("Message queue://")

Dom.Load("C:\test.xml")

Dom.Save(outMsg.GetStream())

inMsg = outMsg.SendforWaitReply(5000)
If inMsg Is Nothing Then
Debug.Write("No Response")
Else
Dom.Load(inMsg.GetStream)
Dom.Save(ResponseText)
Debug.Write(ResponseText)
End If

THis code breaks on the line : Dom.Save(outMsg.GetStream())

saying : Member not Found.

I have check the OutMsg object in object browser and that method does exist.

I am at a wits end with this....

If i could somehow send a non-unicode string to the MSMQ from the website, it would solve all my problems, but VBScript seems to only be able to send Unicode strings.

Has anyone got any idea's I can try.

NB. THe webserver is running Windows 2000 (No .NET framework) - so I cannot even use the C# example on MSDN.

THanks.

Comments

  • navipro_behanavipro_beha Member Posts: 3
    If you take a look at the "Request Handler"-codeunit in comerce portal you see a usage of another msmq component. This one handles the original message (with the 00 hex every other character) and works fine.
  • nstoevnstoev Member Posts: 7
    The Commerce portal codeunit does not use directly the MSMQ bus adapter but rather a special component (part of the Commerce Server installation) which wraps the MSMQ function and does not return a stream but rather a XML DOM document. A similar approach is used by the Employee Portal. So except for writing a wrapper component is there any other solution to the Unicode MSMQ problem?
  • DenSterDenSter Member Posts: 8,307
    Only one way to get around that that I know of, and that is to use the Message queing object model directly. I am in a meeting right now, but if you send me a PM to remind me I will post some code in here later this week.
  • nstoevnstoev Member Posts: 7
    Is it possible to use the MSMQ COM components directly and still register for aMessage-Received event?
  • DenSterDenSter Member Posts: 8,307
    No there is no message received event that I could find. I ended up doing it with a timer that peeks in the queue and picks up the messages if they are there.
Sign In or Register to comment.