• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

.NET integration with ColdFusion

New Here ,
Nov 24, 2009 Nov 24, 2009

Copy link to clipboard

Copied

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.

TOPICS
Advanced techniques

Views

513

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 ,
Nov 24, 2009 Nov 24, 2009

Copy link to clipboard

Copied

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

Votes

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 ,
Nov 24, 2009 Nov 24, 2009

Copy link to clipboard

Copied

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

Votes

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 ,
Nov 24, 2009 Nov 24, 2009

Copy link to clipboard

Copied

LATEST

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

Votes

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
Resources
Documentation