Solved

ATL COM object does nott work in ASP

Posted on 2002-03-29
8
201 Views
Last Modified: 2013-11-25

 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
0
Comment
Question by:stevenmcheerful
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 49

Expert Comment

by:DanRollins
Comment Utility
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
 
LVL 23

Expert Comment

by:naveenkohli
Comment Utility
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
 
LVL 23

Expert Comment

by:Roshan Davis
Comment Utility
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
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 200 total points
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:stevenmcheerful
Comment Utility

 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
 

Author Comment

by:stevenmcheerful
Comment Utility

 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
 
LVL 49

Expert Comment

by:DanRollins
Comment Utility
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
 

Author Comment

by:stevenmcheerful
Comment Utility

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


 - steve
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now