Rational Developer for System z, Version 7.6

Defining common standard elements and types in generated XSD and WSDL

This topic describes the definition parameters for the feature “Including and Referencing Commonly Used Elements and Types”.

The common schema content is defined to the xsebatch command line tool through an XML file that can be specified either on the command line parameter (-commtypes for “Common Types”) or by the “commTypesFile“ attribute specified in the ServiceSpecification.xml file.

The user can override the commtypes xml file specified with the “commTypesFile“ attribute for input and output message elements (InputMessage and OutputMessage) in the Batch processor option specification file (ServiceSpecification.xml).

When the user creates and specifies the commtypes xml file, the WSDL and XSD generation process uses the information specified in the commtypes file to generate elements, types and schema imports instead of the imbedded types, elements and namespaces. The list of common types from the command line parameter can be overridden by the content of the file(s) specified on the commTypesFile attribute.

Table 1 is a listing of the elements and attributes of the Common Types Element.
Table 1. Elements and Attributes of the Common Types Element
Element or Attribute Definition
CommTypes Container element for common groups.
CommGroup Group for listing common type information.
lang Specifies the source language of the application source being processed.
format For source languages that permit fixed or free source formatting, this attribute must specify which format is used. Currently this attribute is reserved and set to "fixed".
CommonType Attributes of this element describe how the common application source data items should be processed (see below).
srcName Specifies the source name of the copybook as it appears in the COBOL application program source. COPY books specified in the srcName attribute are not cross-referenced with the COBOL application source files, but they must be present and accessible to the Batch processor tool when the COBOL application source is processed.
nativeName Specifies the COBOL data item name for which the XML schema reference and type should be taken from the common schema.
commSchemaLocation Specifies the common schema location attribute (xsi:schemaLocation) that is generated in the import statement for the enclosing WSDL or XSD.
Note: For CICS® Webservices scenarios this location must be accessible when the tools are running, Otherwise an error message are displayed and the generation process does not complete.
commNamespace Specifies the value of the namespace declaration that is generated for referring to the common schema.
xmlElementName Specifies the value of the element name from the common schema that should be referred to from the enclosing WSDL or XSD.
commNsPrefix Specifies the value of the namespace prefix that should be generated to qualify the reference of the common elements and types.

Figure 1 is an example of a commtype xml file used to direct the processor to use common types, elements, namespaces, in a COBOL source language sample.

Figure 1. Example of a commtype XML File
 
<?xml version="1.0" encoding="UTF-8"?>
<commtypes:CommonTypes xmlns:commtypes="http://www.ibm.com/xmlent/commxsd/emf/commtypes">
  <commtypes:CommGroup lang="COBOL" format="fixed"> 
    <commtypes:CommonType 
               srcName="COMMHDR" 
               nativeName="commHeader" 
               commSchemaLocation="commHeader.xsd"
               commNamespace="http://www.sample.com/schemas/commHeader"
               xmlElementName="commHeader"
               commNsPrefix="hdr1"
               />
  </commtypes:CommGroup>
</commtypes:CommonTypes>

The commtype xml file schema is shown in Figure 2.

Figure 2. A commtype XML File Schema
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:commtypes="http://www.ibm.com/xmlent/commxsd/emf/commtypes" 
targetNamespace="http://www.ibm.com/xmlent/commxsd/emf/commtypes">
  <xsd:element name="CommGroup">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="commtypes:CommonType" minOccurs="1" maxOccurs="unbounded"/>
      </xsd:sequence>
      <xsd:attribute name="lang" type="xsd:string"/>
      <xsd:attribute name="format" type="xsd:string"/>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="CommonTypes">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="commtypes:CommGroup"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="CommonType">
    <xsd:complexType>
      <xsd:attribute name="srcName" type="xsd:string"/>
      <xsd:attribute name="xmlElementName" type="xsd:string"/>
      <xsd:attribute name="nativeName" type="xsd:string"/>
      <xsd:attribute name="commSchemaLocation" type="xsd:string"/>
      <xsd:attribute name="commNamespace" type="xsd:string"/>
      <xsd:attribute name="commNsPrefix" type="xsd:string"/>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>
When the commtype xml file example shown in Figure 1 is applied to the sample COBOL source and copybooks shown in Figure 1 in the topic Commonly Used Elements and Types, then the generated schema for departmentUpdateRequest is shown in Figure 3 and the generated schema for departmentUpdateReply is shown in Figure 4.
Note: For documentation purposes, only the partial schema is displayed.

Figure 5 shows the commHeader schema.

Figure 3. Example of Part of Schema Generated for departmentUpdateRequest Element
<schema attributeFormDefault="qualified" elementFormDefault="qualified" 
            targetNamespace="http://www.TST01I.com/schemas/TST01IInterface" 
            xmlns="http://www.w3.org/2001/XMLSchema" 
            xmlns:cbl="http://www.TST01I.com/schemas/TST01IInterface"
            xmlns:hdr1="http://www.sample.com/schemas/commHeader"> 
      <import namespace="http://www.sample.com/schemas/commHeader" 
            schemaLocation="commHeader.xsd"/>
      <complexType name="departmentUpdateRequest">
        <sequence>
          <element ref="hdr1:commHeader"/>
          <element form="qualified" name="member_count">
            <simpleType>
              <restriction base="int">
                <minInclusive value="0"/>
                <maxInclusive value="999999999"/>
              </restriction>
            </simpleType>
          </element>
          <element name="dept_details" type="cbl:departmentupdaterequest_dept__details"/>
        </sequence>
      </complexType>
Figure 4. Example of Part of Schema Generated for departmentUpdateReply Element
<schema attributeFormDefault="qualified" elementFormDefault="qualified" 
            targetNamespace="http://www.TST01O.com/schemas/TST01OInterface" 
            xmlns="http://www.w3.org/2001/XMLSchema" 
            xmlns:cbl="http://www.TST01O.com/schemas/TST01OInterface" 
            xmlns:hdr1="http://www.sample.com/schemas/commHeader"> 
      <import namespace="http://www.sample.com/schemas/commHeader" 
            schemaLocation="commHeader.xsd"/>
      <complexType name="departmentUpdateReply">
        <sequence>
          <element ref="hdr1:commHeader"/>
          <element form="qualified" name="updStatus">
            <annotation>
              <appinfo source="http://www.wsadie.com/appinfo">
                <initialValue kind="SPACE"/>
              </appinfo>
            </annotation>
            <simpleType>
              <restriction base="string">
                <maxLength value="3"/>
              </restriction>
            </simpleType>
          </element>
        </sequence>
      </complexType>
      <element name="employeeUpdateRequest" type="cbl:departmentUpdateReply">
        <annotation>
          <documentation source="com.ibm.etools.xmlent.batch">8.0.0.V200803251533</documentation>
        </annotation>
      </element>
    </schema>

Figure 5 is an example of the schema for the commonHdr.xsd file.

Figure 5. Example of Schema Generated for commonHdr.xsd File
<?xml version="1.0" encoding="UTF-8"?><schema attributeFormDefault="qualified" 
elementFormDefault="qualified" targetNamespace="http://www.sample.com/schemas/commHeader" 
xmlns="http://www.w3.org/2001/XMLSchema" xmlns:cbl="http://www.sample.com/schemas/commHeader">
  <complexType name="commheader">
    <sequence>
      <element name="commId">
        <simpleType>
          <restriction base="short">
            <minInclusive value="0"/>
            <maxInclusive value="9999"/>
          </restriction>
        </simpleType>
      </element>
      <element name="commRevDate">
        <annotation>
          <appinfo source="http://www.wsadie.com/appinfo">
            <initialValue kind="SPACE"/>
          </appinfo>
        </annotation>
        <simpleType>
          <restriction base="string">
            <maxLength value="8"/>
          </restriction>
        </simpleType>
      </element>
      <element name="commDigest">
        <annotation>
          <appinfo source="http://www.wsadie.com/appinfo">
            <initialValue kind="SPACE"/>
          </appinfo>
        </annotation>
        <simpleType>
          <restriction base="string">
            <maxLength value="40"/>
          </restriction>
        </simpleType>
      </element>
    </sequence>
  </complexType>
  <element name="commHeader" type="cbl:commheader">
    <annotation>
      <documentation source="com.ibm.etools.xmlent.batch">8.0.0.V200803251533</documentation>
    </annotation>
  </element>
</schema>

Rules and Conditions

This topic lists the rules and conditions for the feature “Including and Referencing Commonly Used Elements and Types”.

The rules and conditions are as follows:
  1. Content of the common types XML file must match the schema specified in this document. If it does not, the behavior of the Batch processor is unpredictable.
  2. If common types XML file is specified on the command line and there are common types xml files that are also specified on the commTypesFile attribute, the common types XML file from the command line is overridden by the information from the file(s) specified with the commTypesFile attribute
  3. If the common types XML file or files are specified (on the command line and/or in the Batch processor options file) but they do not actually exist, the Batch processor issues a warning and proceeds, ignoring the specified file(s).
  4. If the common types XML file is specified on the commTypesFile attribute for input and output message elements, common element and type information applies only to the InputMessage or the OutputMessage for which the commTypesFile attribute is specified.
  5. If the common types XML file is specified on the command line or on the commTypesFile attribute but no items are found in the source file that correspond to any itemName specified in the common types XML file, a warning message is issued.
  6. If common types XML file is specified either on the command line or in the commTypesFile attribute, and GEN_ELEMENT_FORM_QUALIFIED property of the CodeGenProperty attribute is set to false (either in the Batch process configuration file or in the GUI preferences for the workspace) the Batch processor issues a warning and proceeds, ignoring the specified common types XML file(s).

Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)