Error when attempting to reference a method in an instanced COM Object

New Here ,
Jun 23, 2015 Jun 23, 2015

Copy link to clipboard

Copied

I am working with CF 10 on a windows 2008 R2 server. We are attempting to employ the RSA authentication system for logins.

Essentially, when a user has been authenticated a cookie is placed on their client machine and we use a method of a dll to access the username who has been authenticated.

The instancing of the COM object and the calling of the getUserName() method works fine in an ASP script; however when the object is instanced in CF and an attempt is made to access the same method an error is thrown.

I dump the methods of the com object after instancing it using the <CFObject tag. The error is thrown when the getUserName() method or any method for that matter are called. The output is shown below.

In the past I have had very few problems instantiating COM objects. Any idea why CF10 fails on this object which is 64 bit by the way?

object of coldfusion.runtime.com.ComProxy

{13178420-1a25-11d4-b579-005004a92ed0}

Methods RSAGetWebIDURL([out, retval]BSTR)

GetTypeInfo([in]UINT, [in]UI4, [out]VOID, [out, retval]VOID)

GetTypeInfoCount([out]UINT, [out, retval]VOID)

AddRef([out, retval]UI4)

RSAGetUserName([out, retval]BSTR)

QueryInterface([in]USERDEFINED, [out]VOID, [out, retval]VOID)

RSADeleteTagField(BSTR, [out, retval]BSTR)

RSAGetTagField(BSTR, I4, [out, retval]BSTR)

RSASetTagField(BSTR, BSTR, I4, [out, retval]BSTR)

RSAGetCSRFToken([out, retval]BSTR)

OnEndPage([out, retval]VOID)

Invoke([in]I4, [in]USERDEFINED, [in]UI4, [in]UI2, [in]USERDEFINED, [out]VARIANT, [out]USERDEFINED, [out]UINT, [out, retval]VOID)

RSAGetShellField([out, retval]BSTR)

Release([out, retval]UI4)

OnStartPage([in]UNKNOWN, [out, retval]VOID)

GetIDsOfNames([in]USERDEFINED, [in]I1, [in]UINT, [in]UI4, [out]I4, [out, retval]VOID)

Get Properties error([out, retval]I4)

The web site you are accessing has experienced an unexpected error.

Please contact the website administrator.

The following information is meant for the website developer for debugging purposes.

Error Occurred While Processing Request

An exception occurred when executing a COM method.

The cause of this exception was that: AutomationException: 0x80010105 - The server threw an exception..

The error occurred in C:/inetpub/wwwroot/ACAAdvisors/rsatest/RSACookieTest.cfm: line 17

15 :     <cfdump var="#RSACookieAPI#"> 

16 :

17 : <cfset theUserName=RSACookieAPI.RSAGetUsername()>

18 :     <cfoutput>

19 :     <p>

Views

633

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 23, 2015 Jun 23, 2015

Copy link to clipboard

Copied

This link is for the same error on an MS-SQL server, but it _may_ be related.  Check your DLL to make sure that it isn't the deprecated 32-bit dll.

HTH,

^_^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 24, 2015 Jun 24, 2015

Copy link to clipboard

Copied

The DLL is most definitely 64 bit. This was the first issue I thought to look at. Very strange that the ASP instance works fine. The ASP code is almost identical to the CF.  IE.

    <b>VBScript RSA Cookie API Sample</b></font><br>
    <hr size="1" color="#000000">
  
    <!-- Create a RSACookieAPI Object -->

    <%
   Dim RSACookieAPI
   Set RSACookieAPI = Server.CreateObject("Rsacookieapi.RSACookie")
   %>
  
   <p align=right><a href=<%=RSACookieAPI.RSAGetWebIDURL()%>?logoff?RSArand=<%=RSACookieAPI.RSAGetCSRFToken()%>>Logoff</a></p>
  
  

<p>Hello <%=RSACookieAPI.RSAGetUserName() %>.<p>

I suspect the problem is in how the Java proxy wrapper is communicating with the DLL. If you go to OLEview and examine the DLL the following is what you observe.

// Generated .IDL file (by the OLE/COM Object Viewer)

//

// typelib filename: rsacookieapi.dll

[

  uuid(1317840F-1A25-11D4-B579-005004A92ED0),

  version(1.0),

  helpstring("rsacookieapi 1.0 Type Library"),

  custom(DE77BA64-517C-11D1-A2DA-0000F8773CE9, 100663662),

  custom(DE77BA63-517C-11D1-A2DA-0000F8773CE9, 1389720109),

  custom(DE77BA65-517C-11D1-A2DA-0000F8773CE9, "Created by MIDL version 6.00.0366 at Tue Jan 14 22:51:45 2014

")

]

library RSACOOKIEAPILib

{

    // TLib :     // TLib : OLE Automation : {00020430-0000-0000-C000-000000000046}

    importlib("stdole2.tlb");

    // Forward declare all types defined in this typelib

    interface IRSACookie;

    [

      uuid(13178420-1A25-11D4-B579-005004A92ED0),

      helpstring("RSACookie Class")

    ]

    coclass RSACookie {

        [default] interface IRSACookie;

    };

    [

      odl,

      uuid(1317841F-1A25-11D4-B579-005004A92ED0),

      helpstring("IRSACookie Interface"),

      dual,

      oleautomation

    ]

    interface IRSACookie : IDispatch {

        [id(0x60020000)]

        HRESULT OnStartPage([in] IUnknown* piUnk);

        [id(0x60020001)]

        HRESULT OnEndPage();

        [id(0x00000001), helpstring("method RSAGetUserName")]

        HRESULT RSAGetUserName([out, retval] BSTR* pUser);

        [id(0x00000002), helpstring("method RSAGetShellField")]

        HRESULT RSAGetShellField([out, retval] BSTR* pShell);

        [id(0x00000003), helpstring("method RSAGetTagField")]

        HRESULT RSAGetTagField(

                        BSTR Tag,

                        long Encrypted,

                        [out, retval] BSTR* pField);

        [id(0x00000004), helpstring("method RSASetTagField")]

        HRESULT RSASetTagField(

                        BSTR Tag,

                        BSTR Data,

                        long Encrypted,

                        [out, retval] BSTR* pCookieHeader);

        [id(0x00000005), helpstring("method RSADeleteTagField")]

        HRESULT RSADeleteTagField(

                        BSTR Tag,

                        [out, retval] BSTR* pCookieHeader);

        [id(0x00000006), propget, helpstring("property error")]

        HRESULT error([out, retval] long* pVal);

        [id(0x00000007), helpstring("method RSAGetWebIDURL")]

        HRESULT RSAGetWebIDURL([out, retval] BSTR* pWebIDURL);

        [id(0x00000008), helpstring("method RSAGetCSRFToken")]

        HRESULT RSAGetCSRFToken([out, retval] BSTR* pCSRFToken);

    };

};

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jun 24, 2015 Jun 24, 2015

Copy link to clipboard

Copied

That goes back to my initial impression. If the function is returning an HRESULT (a numeric value) then the out parameter has to be supplied.

Just for intellectual curiosity, try the suggestion in my first reply and post the result.

Cheers

Eddie

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 25, 2015 Jun 25, 2015

Copy link to clipboard

Copied

Very Interesting. Apparently it wants to see an argument although it is not called for.

Now observe the results. You can see the  method in the dump but it throws a method not found error.

object of coldfusion.runtime.com.ComProxy

{13178420-1a25-11d4-b579-005004a92ed0}

Methods    RSAGetWebIDURL([out, retval]BSTR)

GetTypeInfo([in]UINT, [in]UI4, [out]VOID, [out, retval]VOID)

GetTypeInfoCount([out]UINT, [out, retval]VOID)

AddRef([out, retval]UI4)

RSAGetUserName([out, retval]BSTR)

QueryInterface([in]USERDEFINED, [out]VOID, [out, retval]VOID)

RSADeleteTagField(BSTR, [out, retval]BSTR)

RSAGetTagField(BSTR, I4, [out, retval]BSTR)

RSASetTagField(BSTR, BSTR, I4, [out, retval]BSTR)

RSAGetCSRFToken([out, retval]BSTR)

OnEndPage([out, retval]VOID)

Invoke([in]I4, [in]USERDEFINED, [in]UI4, [in]UI2, [in]USERDEFINED, [out]VARIANT, [out]USERDEFINED, [out]UINT, [out, retval]VOID)

RSAGetShellField([out, retval]BSTR)

Release([out, retval]UI4)

OnStartPage([in]UNKNOWN, [out, retval]VOID)

GetIDsOfNames([in]USERDEFINED, [in]I1, [in]UINT, [in]UI4, [out]I4, [out, retval]VOID)

Get Properties    error([out, retval]I4)

The web site you are accessing has experienced an unexpected error.

Please contact the website administrator.

The following information is meant for the website developer for debugging purposes.

Error Occurred While Processing Request

The RSAGetUserName method was not found.

There are no methods with the specified method name and argument types. Check your function and retry.

The error occurred in C:/inetpub/wwwroot/ACAAdvisors/rsatest/RSACookieTest.cfm: line 17

15 :     <cfdump var="#RSACookieAPI#"> 

16 :

17 : <cfset theUserName=RSACookieAPI.RSAGetUserName("testUser")>

18 :     <cfoutput>

19 :     <p>

Resources:

Check the ColdFusion documentation to verify that you are using the correct syntax.

Search the Knowledge Base to find a solution to your problem.

Browser      Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36

Remote Address      127.0.0.1

Referrer      http://127.0.0.1/WebID/IISWebAgentIF.dll

Date/Time      25-Jun-15 11:13 AM

Stack Trace

at cfRSACookieTest2ecfm276730541.runPage(C:/inetpub/wwwroot/ACAAdvisors/rsatest/RSACookieTest.cfm:17)

coldfusion.runtime.com.MethodSelectionException: The RSAGetUserName method was not found.

    at coldfusion.runtime.com.ComProxy.invoke(ComProxy.java:518)

    at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2428)

    at cfRSACookieTest2ecfm276730541.runPage(C:\inetpub\wwwroot\ACAAdvisors\rsatest\RSACookieTest.cfm:17)

    at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:244)

    at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:446)

    at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)

    at coldfusion.filter.IpFilter.invoke(IpFilter.java:64)

    at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:451)

    at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)

    at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)

    at coldfusion.filter.PathFilter.invoke(PathFilter.java:112)

    at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:94)

    at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:79)

    at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)

    at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)

    at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:58)

    at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)

    at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)

    at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62)

    at coldfusion.CfmServlet.service(CfmServlet.java:219)

    at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

    at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)

    at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)

    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)

    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)

    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)

    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)

    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)

    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:422)

    at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:199)

    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)

    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)

    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

    at java.lang.Thread.run(Thread.java:722)

Debugging Information

ColdFusion Server Standard    10,0,15,292620

Template    /rsatest/rsacookietest.cfm

Time Stamp    25-Jun-15 11:13 AM

Locale    English (US)

User Agent    Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36

Remote IP    127.0.0.1

Host Name    127.0.0.1

Execution Time

Total Time    Avg Time    Count    Template

11 ms    11 ms    1    C:/inetpub/wwwroot/ACAAdvisors/Application.cfm

7 ms    7 ms    1    top level C:\inetpub\wwwroot\ACAAdvisors\rsatest\RSACookieTest.cfm

7 ms    7 ms    1    CFC[ C:/inetpub/wwwroot/ACAAdvisors/admin/acaaccess.cfc | getThePendingApplicantRecord() ] from C:/inetpub/wwwroot/ACAAdvisors/admin/acaaccess.cfc

1 ms    1 ms    1    CFC[ C:/inetpub/wwwroot/ACAAdvisors/admin/acaaccess.cfc | getData() ] from C:/inetpub/wwwroot/ACAAdvisors/admin/acaaccess.cfc

1 ms    1 ms    1    CFC[ C:/inetpub/wwwroot/ACAAdvisors/admin/acaaccess.cfc | getData3() ] from C:/inetpub/wwwroot/ACAAdvisors/admin/acaaccess.cfc

0 ms    0 ms    1    CFC[ C:/inetpub/wwwroot/ACAAdvisors/admin/acaaccess.cfc | getData2() ] from C:/inetpub/wwwroot/ACAAdvisors/admin/acaaccess.cfc

0 ms    0 ms    1    CFC[ C:/inetpub/wwwroot/ACAAdvisors/admin/acaaccess.cfc | getData4() ] from C:/inetpub/wwwroot/ACAAdvisors/admin/acaaccess.cfc

14 ms         STARTUP, PARSING, COMPILING, LOADING, & SHUTDOWN

32 ms         TOTAL EXECUTION TIME

red = over 250 ms average execution time

Exceptions

11:13:03.003 - Object Exception - in C : line -1

        The getClass method was not found.

       

11:13:03.003 - Object Exception - in C : line -1

        The toString method was not found.

       

11:13:03.003 - Object Exception - in C:/inetpub/wwwroot/ACAAdvisors/rsatest/RSACookieTest.cfm : line 17

        The RSAGetUserName method was not found.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jun 25, 2015 Jun 25, 2015

Copy link to clipboard

Copied

I'm beginning to think your problem is not necessarily specific to that DLL.

Have you successfully tested other COM objects? As a process of elimination, try some of the examples detailed in the ColdFusion Developer's Guide.

Cheers

Eddie

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 25, 2015 Jun 25, 2015

Copy link to clipboard

Copied

The developers guide uses the CDO package as an example. I do not have Office 2007 on my server so I cannot install the CDO package to do the mail test.

Are there any other examples of DLLs that you can think of?

Regards,

Bill

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jun 25, 2015 Jun 25, 2015

Copy link to clipboard

Copied

LATEST

See this page: https://wikidocs.adobe.com/wiki/display/coldfusionen/Creating+and+using+COM+objects

There are examples instantiating the "CDONTS.NewMail" and "Scripting.FileSystemObject" classes. Hopefully at least one of them will work for you.

Cheers

Eddie

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jun 23, 2015 Jun 23, 2015

Copy link to clipboard

Copied

Try the following:

<cfset retVal=RSACookieAPI.RSAGetUsername("theUserName")>
<cfoutput>#theUserName#</cfoutput>

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jun 23, 2015 Jun 23, 2015

Copy link to clipboard

Copied

Never mind. I read the parameter list incorrectly.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines