Skip to main content
Participant
June 23, 2015
Question

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

  • June 23, 2015
  • 2 replies
  • 1026 views

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>

    This topic has been closed for replies.

    2 replies

    EddieLotter
    Inspiring
    June 23, 2015

    Try the following:

    <cfset retVal=RSACookieAPI.RSAGetUsername("theUserName")>
    <cfoutput>#theUserName#</cfoutput>
    EddieLotter
    Inspiring
    June 23, 2015

    Never mind. I read the parameter list incorrectly.

    WolfShade
    Legend
    June 23, 2015

    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,

    ^_^

    wwmeeAuthor
    Participant
    June 24, 2015

    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);

        };

    };

    EddieLotter
    Inspiring
    June 24, 2015

    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