ATL COM object does nott work in ASP


 Hello out there

 wrote my first COM object using the ATL wizard.  In it I parse an XML doc with C++
 and MSXML2

 It works fine as a COM object using an ATL C++ client,  and also from VBscript
 as a standalone program.

But in ASP the IXMLDOMNODEPtr that is assigned the node address as a result
of my XPATH query on the DOM is null only when I try to run it in an ASP page
VBscript.

has anyone seen this type of behaviour before with COM objects in ASP ?

thanks

 - steve
stevenmcheerfulAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Roshan DavisConnect With a Mentor Commented:
1. Confirm that the threading model of the component is safe for use under ASP. Single threaded components should not called from ASP because they do not marshal security context, and they lock the application down to a single thread of execution. Only Apartment (STA), Free, and Both threaded components can be used safely from ASP.


2. Confirm that the component implements IDispatch. Working from ASP includes implementing IDispatch and the component needs to be thread-safe because ASP is a multi-threaded automation client.

Roshmon
0
 
DanRollinsCommented:
Is the ASP code running on the same computer as the C++ test code?  

I think this might be a specific problem relating to the MSXMLx.DLL that is installed on the machine that is running the ASP code.  Microsoft has caused severe problems for many programmers by releasing a bunch of incompatible versions of the XML DOM.

-- Dan
0
 
naveenkohliCommented:
If you have XMLDOMDocument pointer as method parameter, it is going to have problem. If you want to use your ATL component in ASP page, then you will have to make changes to your method signature and convert the out param as VARIANT. And stuff your IXMLDOMNODEPtr into VARIANT ans return to client.
It really sucks :-)
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
Roshan DavisCommented:
U should have to set the ATL component threading to Both. Then only it can use some function from VB or ASP. That is deriving from IDispatch instead of IUnknown will only work in VB and ASP

GOOD LUCK
0
 
stevenmcheerfulAuthor Commented:

 Thanks - I did not set up the threading properly.  But the biggest issue seemed to be
                   the AppPath, which is an issue I don't have in standalone mode.

                Without my usual debuggin aid of writing to cout <<  which doesn't work in COM
               I didn't know that I had a file path issue

             But your information on threading is absolutely correct.

    thanks  again

  - steve

0
 
stevenmcheerfulAuthor Commented:

 Thanks - I did not set up the threading properly.  But the biggest issue seemed to be
                   the AppPath, which is an issue I don't have in standalone mode.

                Without my usual debuggin aid of writing to cout <<  which doesn't work in COM
               I didn't know that I had a file path issue

             But your information on threading is absolutely correct.

    thanks  again

  - steve

0
 
DanRollinsCommented:
A debugging tip:  Rather than cout, write yourself a function that appends lines of debggung text to a log file.  Then you are one double-click away from solving your problem.

-- Dan
0
 
stevenmcheerfulAuthor Commented:

  Thanks Dan  -  you are right  a  little logging would have saved me a day,  maybe more


 - steve
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.