locked
COM object Interface issue RRS feed

  • Question

  • User-1087976105 posted

    Hello all

    I'll start off by saying I'm a bit of a noob with ASP.NET  I do know a bit of vb from the old days though.

    Using Visual Web Developer 2008 express I've written a dll in vb.net that interfaces with another COM dll called CybersourceWSLib

    In my class, called cybersource I interact with a few of the Interfaces inside the CybersourceWSLib COM dll.

    My problem is that when I attempt to use one of the properties of the interface from my web page like so:

    Imports Cybersource.cyber1.cyb
    Partial Class registration
        Inherits System.Web.UI.Page
        Private Shared oCyb As New Cybersource.cyber1.cyb
    <snip>
           oCyb.EnableLog = "0"
    

    I get:

    "System.NullReferenceException: Object reference not set to an instance of an object."

    I've declared the interfaces inside the dll but I'm guessing they are not initailized???  I dunno

    Here is where I declare them in the class inside my vb.net dll

    Namespace cyber1

    Public Class Cyb

    Private Shared objMerchConfig As CyberSourceWSLib.IMerchantConfig

    Private Shared oRequest As New System.Collections.Hashtable

    Private Shared oReply As New System.Collections.Hashtable

    Private Shared oClient As CyberSourceWSLib.IClient


    My web page access the properties in my dll through :

    Public Shared Property LogDirectory() As String
                Get
                    Return objMerchConfig.LogDirectory
                End Get
                Set(ByVal value As String)
                    objMerchConfig.LogDirectory = value
                End Set
    End Property

    That is when I get the error.

    What do I need to do to make this work.




    Friday, September 4, 2009 2:18 PM

Answers

All replies

  • User116058376 posted

    Hi Russ,


    You are correct, the intialization is the problem here. use any reflectors like Lutz Roeder's .NET Reflector

    to find out what are the methods available in the com object and try to use initialize the object before using the properties.

    Friday, September 4, 2009 2:48 PM
  • User-1087976105 posted

    Thanks for the reply

    I thought so.  Now How would I actually initialized them?

    Doing a x As New interface  generates an error.


    Friday, September 4, 2009 3:03 PM
  • User-952121411 posted

    Did you get this solved here on your other thread which appears to be the same issue:

    http://forums.asp.net/p/1468080/3393167.aspx

    If not, I reccomend getting the API documentation from Cybersource and looking at thier code examples.  I have done something similar with PayPal before, and you can look at their documentation to see best how to use their exposed .dll.

    As a last resort you can use that reflection tool offered previously, but it would be odd that CyberSource does not offer some sort of documentation or support for their provided .dll. 

    There are some great support links for developers on the CyberSource site which you should look into if you have not already:

    http://www.cybersource.com/support_center/implementation/downloads/

    http://apps.cybersource.com/library/documentation/sbc/api_guide/html/

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 23, 2009 4:54 PM