3 Replies Latest reply on Nov 24, 2009 11:27 AM by MN_Aso

    .NET integration with ColdFusion

    MN_Aso

      I am trying to integrate some .NET business objects into ColdFusion but have run into a problem with ColdFusion always making my method calls upper case.

       

      Here is the snipper of code I am having issues with.

       

          objCustomer = CreateObject(".NET", "TestLibrary.BusinessObjects.Customer", "TestLibrary.dll");

       

          objCustomer.FirstName = "El";
          objCustomer.LastName = "Heffe";
          objCustomer.CustomerType = "Deviant";

       

      When the page is ran the error message is

       

      Element FIRSTNAME is undefined in OBJCUSTOMER.

      The error occurred in C:\Inetpub\wwwroot\Test\wsTest.cfm:  line 28
      26 : </cfscript>
      27 : <cfobject type=".NET" name="objCustomer" class="TestLibrary.BusinessObjects.Customer" assembly="TestLibrary.dll">
      28 : <cfset objCustomer.FirstName.set("El")>
      29 : <cfset objCustomer.LastName = "Heffe">
      30 : <cfset objCustomer.CustomerType = "Deviant">

      Resources:

       

      Browser  Mozilla/5.0  (Windows; U; Windows NT 5.1; en-US; rv:1.9.2b3) Gecko/20091115  Firefox/3.6b3
      Remote  Address  127.0.0.1
      Referrer 
      Date/Time  24-Nov-09  10:48 AM

       

      Stack Trace
      at  cfwsTest2ecfm1594120296.runPage(C:\Inetpub\wwwroot\Test\wsTest.cfm:28)                                  

      coldfusion.runtime.UndefinedElementException: Element FIRSTNAME is undefined in OBJCUSTOMER.
           at coldfusion.runtime.DotResolver.resolveSplitNameInMap(DotResolver.java:108)

       

      The variables I am trying to set in the .NET object are getter/setter methods and are used in the test .NET application just fine.

       

      Why is ColdFusion upper casing the method call? My guess it has to due with dot notion and how it works when creating cf structures. How do I get around this "functionality"

       

      Thanks.

        • 1. Re: .NET integration with ColdFusion
          Adam Cameron. Level 5

          Try associative array notation: objCustomer["FirstName"].

           

          I dunno why CF monkeys with the casing of variable names / struct keys when using dot notation.  Probably some necessity to implement CF's caselessness with Java.

           

          --

          Adam

          1 person found this helpful
          • 2. Re: .NET integration with ColdFusion
            MN_Aso Level 1

            Getting closer to having it work. Have found that with Getter/Setter methods ColdFusion interacts with them differently. Still trying to figure out how to get a enum to work.

             

            Here is an updated code snippet.

             

                objCustomer = CreateObject(".NET", "TestLibrary.BusinessObjects.Customer", "TestLibrary.dll");

             

                objCustomerType = CreateObject(".NET", "TestLibrary.Enums.CustomerType", "TestLibrary.dll");

             

                objCustomer.Set_FirstName("El");


                objCustomer.Set_LastName("Heffe");
                objCustomer.Set_CustomerType(JavaCast(enum,1));
            • 3. Re: .NET integration with ColdFusion
              MN_Aso Level 1

              Figured out enums so one to other issues. Here is the code if anyone else needs an answer.

               

                  objCustomer = CreateObject(".NET", "TestLibrary.BusinessObjects.Customer", "TestLibrary.dll");
                  objCustomerType = CreateObject(".NET", "TestLibrary.Enums.CustomerType", "TestLibrary.dll");
                 
                  objCustomer.Set_FirstName("El");
                  objCustomer.Set_LastName("Heffe");
                  objCustomer.Set_CustomerType(objCustomerType.Sad);