2.4.2 XML Schema User Defined Data Type Mapping

The following lists the supported XML Schema User Defined Simple Data Type and the corresponding Oracle Tuxedo FML32 Field Data Type.

Table 2-7 Supported XML Schema User Defined Data Type

XML Schema User Defined Data Type Oracle Tuxedo FML32 Field Data Type C/C++ Primitive Type In Oracle Tuxedo Program Note
<xsd:anyType> FLD_MBSTRING char [] You should prepare entire XML document enclosing with the element tag.
<xsd:simpleType> derived from built-in primitive simple data types Equivalent FML32 Field Type of the primitive simple type see Table 2-3) Equivalent C Primitive Data Type of the primitive simple type Table 2-3 Facets defined with <xsd:restriction> are not enforced in Oracle Tuxedo.
<xsd:simpleType>defined with <xsd:list> FLD_MBSTRING char [] Same as <xsd:anyType>. The Schema compliance is not enforced in Oracle Tuxedo.
<xsd:simpleType> defined with <xsd:union> FLD_MBSTRING char [] Same as <xsd:anyType>. The Schema compliance is not enforced in Oracle Tuxedo.
<xsd:complexType> defined with <xsd:simpleContent> FLD_MBSTRING char [] Same as <xsd:anyType>. The Schema compliance is not enforced in Oracle Tuxedo.
<xsd:complexType> defined with <xsd:complexContent> FLD_MBSTRING char [] Same as <xsd:anyType>. The Schema compliancy is not enforcedin Oracle Tuxedo.
<xsd:complexType>defined with shorthand <xsd:complexContent>, sub-elements composited with sequence or all FLD_FML32 FBFR32 * embedded fml32 buffer Each sub-element of the complex type is defined as an embedded FML32 field.
<xsd:complexType> defined with shorthand <xsd:complexContent>, sub-elements composited with choice FML_FML32 FBFR32 * embedded fml32 buffer Each sub-element of the complex type is defined as an embedded FML32 field.

You should only add one sub field into the fml32 buffer.

<xsd:complexType> with sub-elements composited with sequence. The complexType can contain attribute and elements. FLD_FML32 FBFR32 * embedded fml32 buffer Each sub-element of the complex type is defined as an embedded FML32 field.

The following samples demonstrate how to prepare data in an Oracle Tuxedo program for XML Schema User Defined Data Types:

Table 2-8 XML Schema User Defined Type Sample - xsd:simpleType Derived from Primitive Simple Type

XML Schema Definition
-
<xsd:element name=”Grade” type=”Alphabet” />
<xsd:simpleType name=”Alphabet”>
<xsd:restriction base=”xsd:string”>
<xsd:maxLength value=”1” />
<xsd:pattern value=”[A-Z]” />
</xsd:restriction>
</xsd:simpleType>
Corresponding FML32 Field Definition (FLD_STRING)
- # Field_name Field_type Field_flag Field_comments Grade string -
C Pseudo Code
-
char grade[2];
FBFR32 * request;
...
grade[0] = ‘A’; grade[1] = ‘\0’;
Fadd32( request, Grade, (char *)grade, 0);

Table 2-9 XML Schema User Defined Type Sample - xsd:simpleType Defined with xsd:list

XML Schema Definition (Target Namespace “urn:sample.org”)
-
<xsd:element name=”Users” type=”namelist” />
<xsd:simpleType name=”namelist”>
<xsd:list itemType=”xsd:NMTOKEN”>
</xsd:simpleType>
Corresponding FML32 Field Definition (FLD_MBSTRING)
-
Field_name Field_type Field_flag Field_comments
Users mbstring -
C Pseudo Code
-
char * user[5];
char users[...];
char * mbpacked;
FLDLEN32 mbsize = 1024;
FBFR32 * request;
...
sprintf(users, “<n1:Users xmlns:n1=\”urn:sample.org\”>”);
for ( i = 0 ; i < 5 ; i++ ) {
strcat(users, user[i]);
strcat(users, “ “);
}
strcat(users, “</n1:Users>“);
...
mbpacked = malloc(mbsize);
/* prepare mbstring*/
Fmbpack32(“utf-8”, users, strlen(users), mbpacked, &mbsize, 0);
Fadd32( request, Users, mbpacked, mbsize);

Note:

In the following table, attributes are supported in External Web Services calls using the form "<xs:attribute name="[name]" type="[type]"/>" only. Qualifiers such as "fixed=" are currently not supported."

Table 2-10 External Service Schema Attribute Use Example

XML Schema Definition
-
<xs:element name="add">
<xs:complexType>
<xs:sequence>
<xs:element name="param0" nillable="true" type="xs:int"/>
<xs:element name="param1" nillable="true" type="xs:int"/>
</xs:sequence>
<xs:attribute name="aType" type="xs:string"/>
</xs:complexType>
</xs:element>
Corresponding FML32 Field Definition
-
…
#name rel-number type flags comment
#---- ---------- ---- ------ -------
add 1 fml32 - fullname=add, schema=axis2:add
aType 3 string - fullname=aType, schema=xs:string
param0 4 long - fullname=param0, schema=xs:int
param1 5 long - fullname=param1, schema=xs:int
Corresponding SALT Metadata Repository Definition
-
…
servicemode=webservice
inbuf=FML32
outbuf=FML32
errbuf=FML32
param=add
access=in
paramschema=XSD_E:add@http://calc.sample
type=fml32
(
param=param0
access=in
paramschema=XSD_E:param0@http://calc.sample
type=long
primetype=int
 
param=param1
access=in
paramschema=XSD_E:param1@http://calc.sample
type=long
primetype=int
 
param=aType
access=in
paramschema=XSD_E:attribute:aType@http://calc.sample
type=string
primetype=string
 
)
…
Corresponding Sample Pseudo code
-
FBFR32 *f, *fin;
long len;
FLDLEN32 len2;
long inputnum1, inputnum2;
char ret_val[25];
char ret_attr[25];
char *programName;
int counter;
...
char addType[25];
strcpy(addType,argv[1]);
Fadd32(fin, aType, addType, 0);
inputnum1 = atoi(argv[2]);
Fadd32(fin, param0, (char *)&inputnum1, 0);
inputnum1 = atoi(argv[2]);
Fadd32(fin, param0, (char *)&inputnum1, 0);
Fadd32(f, add, (char *)fin, 0)
tpcall("add", (char *)f, 0, (char **)&f, &len, TPSIGRSTRT)