Solved

ATL COM object does nott work in ASP

Posted on 2002-03-29
8
202 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
twoTwo  challenge 35 93
zeroFront challenge 7 80
Need a complete list of ASP.NET page load events 3 29
VS2015 Redefinition errors 4 30
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
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…

863 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

18 Experts available now in Live!

Get 1:1 Help Now