Solved

ATL COM object does nott work in ASP

Posted on 2002-03-29
8
205 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need to impress with my knowledge of .NET 5 104
firstChar challenge 13 148
Sed question 2 139
Problem to App source 6 120
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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…

734 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