Skip to main content
Participant
May 31, 2012
Question

InvokeMethod from C#/CSharp for a function with Struct type argument

  • May 31, 2012
  • 1 reply
  • 3581 views

I am in the process of creating a .Net utility to help us with some ColdFusion functions and in the .Net utility I still need to call some ColdFusion functions.  The function is expecting a Struct type.

After much internet searching I have been unable to determine what type of object I need to use in C#/CSharp that will convert to the type="Struct" argument.

I receive the following error in C#/CSharp when trying to call the InvokeMethod method.

"... cannot convert to type 'Map'"

I have tried to use HashTable, DataTable, etc...

Is there anyway I can invoke a ColdFusion function with a Struct type argument from C#/CSharp?

    This topic has been closed for replies.

    1 reply

    BKBK
    Community Expert
    Community Expert
    May 31, 2012

    jmwolman wrote:

    Is there anyway I can invoke a ColdFusion function with a Struct type argument from C#/CSharp?

    Yes, write a web service in ColdFusion, and then invoke it from C# or, indeed, from wherever you like. Otherwise, you cannot expect C# to call ColdFusion or vice versa.

    jmwolmanAuthor
    Participant
    May 31, 2012

    I have a ColdFusion web service I am dynamically connecting to the wsdl file from C# and trying to call one of the ColdFusion web service functions from with my C# utility

    Part of my ColdFusion code:

    cfcomponent displayname="componentName" output="false">

    <cffunction name="ComponentFunction" returntype="struct">

      <cfargument name="Argument1" type="Struct">

    The problem I am having is when I invoke the "ComponentFunction" function from within my C# utilty I am having problems trying to determine what type of C# object I need to send for the Argument1 argument.  This is where I have tried to use a HashTable and DataTable and an Array, but I get the cannot convert to 'Map' error.

    BKBK
    Community Expert
    Community Expert
    May 31, 2012

    C# doesn't know what a ColdFusion struct is, naturally. Experiment with: <cfargument name="Argument1" type="any">.