IDL data types

When you use the DataObject domain with CORBA, you need to know how XML schema and ESQL types correspond to the types in the IDL file.

Primitive IDL types

The following table shows the mapping between IDL types, XML schema simple types, and ESQL types.
IDL XML schema ESQL
boolean xsd:boolean BOOLEAN
char
<xsd:simpleType name="char">
<xsd:restriction base="xsd:string">
<xsd:length value="1" fixed="true/>
</xsd:restriction>
</simpleType>
CHARACTER
wchar
<xsd:simpleType name= "wchar">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
CHARACTER
double xsd:double FLOAT
float xsd:float FLOAT
octet xsd:unsignedByte INTEGER
long xsd:int INTEGER
Long long xsd:long INTEGER
short xsd:short INTEGER
string xsd:string CHARACTER
wstring xsd:string CHARACTER
Unsigned short xsd:unsignedShort INTEGER
Unsigned long xsd:unsignedInt INTEGER
Unsigned long long xsd:unsignedLong DECIMAL

Complex IDL types

IBM® Integration Bus supports the following complex IDL types:
  • Enums
  • Typedefs
  • Sequences
  • Structures
Each complex type is supported in the following places:
  • Return types for operations
  • In parameters
  • Inout parameters
  • Out parameters
  • Inside exceptions
  • Inside structures
  • Inside sequences
  • Inside typedefs
The following examples show the mapping between IDL types, XML schema, and XML.
Enums
IDL Enums are mapped to enumerations in XML schema. Enums inside the tree are of type string.
Here is an example IDL file:
enum myEnum {A, B, C};
interface example {
	void myoperation(in myEnum input1);
};
Here is an example XML schema:
<xsd:simpleType name="myEnum">
	<xsd:restriction base="xsd:string"> 
		<xsd:enumeration value="A"/> 
		<xsd:enumeration value="B"/>
		<xsd:enumeration value="C"/>
	</xsd:restriction> 
</xsd:simpleType>
Here is an XML example:
<example.myoperation>
	<input1>A</input1>
</example.myoperation>
Sequences and typedefs
IDL typedefs are mapped to XML schema type restrictions. IDL sequences are mapped to XML schema sequence complex types. Sequences can be used only within typedefs.
Here is an example IDL file:
Typedef long myLong; 
typedef sequence<long> longSeq; 
interface example { 	
	void myoperation(in longSeq input1, inout myLong input2); 
};  
Here is an example XML schema:
<xsd:complexType name="longSeq"> 
	<xsd:sequence> 
		<xsd:element name="item" minOccurs="0" maxOccurs="unbounded" type="xsd:int"/>
	</xsd:sequence>
</xsd.complexType>
A sequence can be bounded with the syntax sequence<long, 10>, which puts a bound in the XSD file.
Here is an XML example:
<example.myoperation>
	<input1>
		<item>10</item>
		<item>11</item>
		<item>12</item>
	</input1>
</example.myoperation>
Structures
IDL structures are mapped to XML schema complexType definitions.
Here is an example IDL file:
struct myStruct { 
	char c; 
	string str;
	octet o; 
	short s; 
	unsigned long long ull; 
	float f; 
	double d; 
};
interface example {
	void myoperation(in myStruct input1);
};
Here is an example XML schema:
<xsd:complexType name="myStruct">
	<xsd:sequence>
		<xsd:element name="c" type="xsd:string" maxOccurs="1" minOccurs="1"/> 
		<xsd:element name="str" type="xsd:string" nillable="true" maxOccurs="1" minOccurs="1"/>
		<xsd:element name="o" type="xsd:byte" maxOccurs="1" minOccurs="1"/> 
		<xsd:element name="s" type="xsd:short" maxOccurs="1" minOccurs="1"/> 
		<xsd:element name="ull" type="xsd:unsignedLong" maxOccurs="1" minOccurs="1"/>
		<xsd:element name="f" type="xsd:float" maxOccurs="1" minOccurs="1"/>
		<xsd:element name="d" type="xsd:double" maxOccurs="1" minOccurs="1"/> 
	</xsd:sequence>
</xsd:complexType>
Here is an XML example:
<example.myoperation>
	<input1>
		<c>c</c>
		<str>hello</str>
		<o>12</o>
		<s>10</s>
		<ull>110</ull>
		<f>12.0</f>
		<d>12.1</d>
	</input1>
</example.myoperation>

Modules

In CORBA, modules provide scope. If an interface is contained in a module in the IDL file, the interface name is qualified with the module name in the following format:
ModuleName.InterfaceName.OperationName
The following example shows a module in an IDL file.
Module one {
	Interface OneAInterface {
	};
};
The fully qualified name of the interface called OneAInterface is one.OneAInterface. In an IDL file, modules can be nested in other modules. In this case, the fully qualified name of the interface can include more than one module name, starting from the root module; for example:
ModuleNameA.ModuleNameB.InterfaceName.OperationName
An IDL file can contain more than one operation with the same name provided that the operations are in different modules.