Previous Table of Contents Next


7.4 Simple Type Conversion

   This section shows how simple types used in WSDL are mapped to CORBA.

7.4.1 Mapping for SOAP Data Types

   According to the SOAP 1.1 specification, all types defined in section “3. Built-in datatypes? of “W3C Working Draft “XML Schema Part2: Datatypes? are adopted as simple types. The SOAP-ENC schema and namespace declares an element for all these simple types. Mapping of SOAP data type to IDL data type is performed according to the table below.

   (In the following table, the SOAP data types are shown in the conventional “SOAP-ENC? namespace, to distinguish them from the IDL types).

SOAP data type CORBA data type
SOAP-ENC:int long
SOAP-ENC:unsignedInt unsigned long
SOAP-ENC:short short
SOAP-ENC:unsignedShort unsigned short
SOAP-ENC:long long long
SOAP-ENC:unsignedLong unsigned long long
SOAP-ENC:float float
SOAP-ENC:double double
SOAP-ENC:boolean boolean
SOAP-ENC:string wstring The mapping for string datatype is discussed in Section 7.4.5, “Mapping for String Types,? on page 16.
SOAP-ENC:unsignedByte octet
Enumerations . enum Error if the base is not a string. The mapping for enumerations is discussed in Section 7.4.4, “Mapping for Enumerators,? on page 15.
Arrays sequence, if one-dimensional variant, array, otherwise The mapping for Array datatype is discussed in Section 7.6, “Mapping for SOAP Array Type,? on page 20
Structs struct

7.4.2 Mapping for XML Schema Built-in Datatypes

   WSDL supports the XML Schema built-in datatypes that are defined in “3. Built-in datatypes? of W3C Working Draft “XML Schema Part2: Datatypes.? These XML Schema built-in datatypes map onto a corresponding IDL type as shown in the table below.

   (In the following table, the XML Schema types are shown in the conventional “xsd? namespace, to distinguish them from the IDL types).

XML Schema Data Type

primitive

derived

CORBA Data Type

xsd:string wstring The mapping for string datatype is discussed in Section 7.4.5, “Mapping for String Types,? on page 16.
xsd:boolean boolean
xsd:float float
xsd:double double
xsd:decimal See Section 7.4.3, “Restriction to WSDL Type System,? on page 14
xsd:duration See Section 7.4.3
xsd:dateTime See Section 7.4.3
xsd:time See Section 7.4.3
xsd:date See Section 7.4.3
xsd:gYearMonth See Section 7.4.3
xsd:gYear See Section 7.4.3
xsd:gMonthDay See Section 7.4.3
xsd:gDay See Section 7.4.3
xsd:gMonth See Section 7.4.3
xsd:hexBinary See Section 7.4.3
xsd:base64Binary See Section 7.4.3
xsd:anyURI wstring
xsd:QName See Section 7.4.3
xsd:NOTATION See Section 7.4.3
xsd:normalizedString wstring
xsd:token wstring
xsd:language wstring
xsd:NMTOKEN wstring
xsd:NMTOKENS wstring
xsd:Name wstring

xsd:NCName wstring
xsd:ID wstring
xsd:IDREF wstring
xsd:IDREFS wstring
xsd:ENTITY wstring
xsd:ENTITIES wstring
xsd:integer fixed
xsd:nonPositiveInteger See Section 7.4.3
xsd:negativeInteger See Section 7.4.3
xsd:long long long
xsd:int long
xsd:short short
xsd:byte See Section 7.4.3
xsd:nonNegativeInteger See Section 7.4.3
xsd:unsignedLong unsigned long long
xsd:unsignedInt unsigned long
xsd:unsignedShort unsigned short
xsd:unsignedByte octet
xsd:positiveInteger See Section 7.4.3

   If the XML Schema name space is one of the following, the above conversion takes place. It will be possible to override the conversion rule with external property files.

7.4.3 Restriction to WSDL Type System

   The following datatypes cannot be directly mapped to a corresponding OMG IDL datatype. This interworking specification provides a generic mapping of these unsupported types to individual typedefs of OMG IDL wstring, to hold the UTF encoding of the XML schema type value.

   decimal, nonPositiveInteger, nonNegativeInteger,PositiveInteger,NOTATION,duration,

   time,

   dateTime,

   date,

   gYearMonth,

   gYear,

   gMonthDay,

   gDay,

   gMonth,

   hexBinary,

   base64Binary,

   Qname,

   The IDL module (using omg.org type prefix) that defines the corresponding types is:

   module stringmappedXMLtypes {

    typeprefix stringmappedXMLtypes "omg.org";

    typedef wstring decimal;

    typedef wstring nonPositiveInteger;

    typedef wstring nonNegativeInteger;

    typedef wstring PositiveInteger;

    typedef wstring NOTATION;

    typedef wstring duration;

    typedef wstring time;

    typedef wstring dateTime;

    typedef wstring date;

    typedef wstring gYearMonth;

    typedef wstring gYear;

    typedef wstring gMonthDay;

    typedef wstring gDay;

    typedef wstring gMonth;

    typedef wstring hexBinary;

    typedef wstring base64Binary;

    typedef wstring Qname,

   };

7.4.4 Mapping for Enumerators

   The enumeration in XML Schema is used to constrain the values of almost every simple type, except the boolean type. It limits a simple type to a set of distinct values.

   Enumeration in XML Schema derived by restriction on ‘string’ can be mapped to IDL enumeration.

   Here is an example.

   <!--WSDL -->

   <simpleType name =?A_or_B_or_C? restriction base=?string?

   <enumeration value = “A? />

   <enumeration value = “B? />

   <enumeration value = “C? />

   </simpleType name>

   // OMG IDLenum A_or_B_or_C {A, B, C};

   If the restriction is on any other datatype, it cannot be mapped to OMG IDL.

7.4.5 Mapping for String Types

   String is the set of finite-length sequences of characters in XML. It is mapped to OMG IDL wstring datatype.

   String datatypes derived by restriction of Schema components <length> and <maxLength> are treated as bounded wstring.

   Note – If the value of the <length> element is 1 and value of attribute fixed is true, it can be mapped to OMG IDL wchar datatype. This specification only specifies mapping to IDL wstring datatype.

String Type

bounded

unbounded

WSDL

IDL

string derived by restriction of • length N • maxLength N wstring <N> wstring <N>
string wstring
string derived by restriction of • minlength N • pattern wstring wstring

   Example:

   <!--WSDL --><element name="Country" type="string"/>

   <element name="Place"> <simpleType><restriction base="string"><length value="5"/></restriction></simpleType></element>

   // OMG IDL

   wstring Country;const short N=5;wstring Place<N>;

7.4.6 Mapping for Any

   The anyType represents an abstraction called the ur-type that is the base type from which all simple and complex types are derived. An anyType type does not constrain its content in any way. It is possible to use anyType like other type. It can be mapped to the OMG IDL datatype any.

   Example:

   <!--WSDL --><element name="T" type="anyType"/>

   // OMG IDL

   any T;

7.4.7 Anonymous XML Types

   Anonymous types are deprecated in CORBA. While it is allowable, in some cases, to map an anonymous XML type specification to an anonymous IDL type spec (e.g., for sequences as members of an IDL struct), there are cases that require an explicit IDL type name (e.g., for operation parameters).

   Whenever it is explicitly required by the IDL syntax, the anonymous XML types are mapped to an explicit IDL typedef.

   The name of the type to use for the generated IDL typedef is constructed by prefixing the name of the element (which has an anonymous XML type specification attached) with the string "T_." In case of collision with another type starting with "T_," the translator will add sufficient extra "_" character(s) to the end of the prefix to resolve the collision.