Solved

ATL COM object does nott work in ASP

Posted on 2002-03-29
8
204 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
ID: 6906076
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
ID: 6906392
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
ID: 6909706
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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
LVL 23

Accepted Solution

by:
Roshan Davis earned 200 total points
ID: 6909710
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
 

Author Comment

by:stevenmcheerful
ID: 6910442

 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
ID: 6910669

 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
ID: 6910863
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
ID: 6912737

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


 - steve
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SignTool Error with Windows 10 5 183
Why is "packages element is not declared"? 2 337
Making an alias 7 101
Input parameteres to DragOver 2 20
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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…

820 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