Calling CORBA Objects

In the cfobject tag, you must specify the following attributes when calling CORBA objects:

For the complete cfobject syntax, see the CFML Reference.

Declaring structures and sequences

After you create the object, you can invoke attributes and operations on the object using the syntax outlined in the previous sections. ColdFusion also supports the use of complex types such as structures and sequences. For structures, use ColdFusion structures; for sequences, use ColdFusion arrays.

Example

Here is the IDL for an object:

struct SimpleStruct

{

  short s;

  long l;

  float d;

};



struct NestedStruct

{

  SimpleStruct f;

  char c;

  string s;

};



typedef sequence<long, 5> BLongSequence;



interface SomeObject {

  short SomeMethod( in NestedStruct inStruct,  in BlongSequence inSeq);



};

Here is the applicable ColdFusion code:

<!--- Declare a couple of structures --->

<cfset x = StructNew()>

<cfif IsStruct(x)>

  <cfset temp=StructInsert(x,"s",3)>

  <cfset temp=StructInsert(x,"l", 256)>

  <cfset temp=StructInsert(x,"d", 93.45)>

</cfif>



<cfset NestedStruct = StructNew()>

<cfif IsStruct(NestedStruct)>

  <cfset temp=StructInsert(NestedStruct,"f",x)>

  <cfset temp=StructInsert(NestedStruct,"c", 'b')>

  <cfset temp=StructInsert(NestedStruct,"s", " Test")>

</cfif>



<!--- Declare a sequence --->

<cfset FixedSeq = ArrayNew(1)>



<cfloop index="LoopCount" from="1" TO="5">

  <cfset FixedSeq [LoopCount] = #LoopCount#>

</cfloop>



<cfset retA=obj.SomeMethod(NestedStruct, FixedSeq)>

Exception handling

You can catch exceptions thrown by the CORBA object methods with the cftry and cfcatch tags. However, you cannot extract information from the exception object.



Banner.Novgorod.Ru