I have a codeunit in Navision that uses an Automation COM DLL - that basically reads or posts to a Microsoft Message Queue. I can run the codeunit directly from a Navision client with no errors - but when I try to get the Application Server (on the same machine) to do it I get “Internal Error 33 in module 35” in the Event log, which is in the error list as: 35-33 #Err_OCX_IDispatch (Module_OCX, 33) This would seem to suggest to me the control is not registered properly - however then I wouldn’t be able to run it from within Navision. The DLL uses no forms or other graphical interfaces - the only external resource it uses is msxml3.dll which is in the Windows System directory as normal… Any ideas?
What Automation object do you use to do the job ?
It is one of my own to replace CPHandler.DLL. It is simply a DLL that has both a COM and .NET interface which allows you to pass XML to the Microsoft Message Queue. I have it working fine on another site - and it works from this site as well when I run the objects through the normal Navision Client…
Have you ever tried to use the Navision ComCom and the MSQBA automation server which is included in the Navision installation ? It works for me with no problems at all. Can you test what happens when you run your Navision Application Server from the commandline instead of the service ? It will most probably work [:D]
Unfortunately I got the same error from the Command Line Internal Error 33 in Module 35. I have used the ComCom objects before and they worked ok - but then, I’ve also used my COM object many times with no problems, and I’d rather not rewrite my code at this stage…
The error message most probably does not mean that the control is not registered properly. It is probably closer to the fact that the data types used are not 100% right. Do you use any complex datatypes as parameters or return values in Navision ? Are you using a trigger from the automation control in Navision ? Are you running it in a single instance codeunit ?
I’m not exactly sure how to handle this, but the IDispatch is the datatype that the message queue uses, and I don’t think Navision knows how to handle this. That’s why it has the ComCom and the MQ-BA, to translate the incoming data. Unfortunately, the ComCom and the BA are severely limited. You can also use the message queing object model directly. That returns a variant that you can at least handle for text type and some of the object types. I have a working solution with message queing and the MS XMLDOM. That way you can leverage the whole thing directly in Navision.
Do you use any complex datatypes as parameters or return values in Navision ? Are you using a trigger from the automation control in Navision ? Are you running it in a single instance codeunit ?
Yes - an XML DOMDocument as a parameter No Yes The thing I really don’t understand is that I can run the codeunit from the Object Designer and it works, and communicates correctly with the MSMQ - I would expect to see any data type errors or anything else when I do this. The Application Server is on the same machine, and uses the same Windows Account - and crashes.
With that - I have narrowed it down to the XML DOMDocument as a parameter in the COM object. Anytime the Application Server tries to Create the Object (without even calling the function) it throws this error… Navision is v4 SP1… maybe its a bug
On further investigation I have discovered it was only COM objects created in a .NET environment that caused the issue. Installing .NET v2.0 framework seems to have fixed the problem - perhaps Navision v4 doesn’t interact with .NET 1.4 very well?