Rational Developer for System z

Commonly Used Elements and Types

This topic describes how Enterprise Service Tools users can include and reference commonly used interface elements (which are derived from COBOL copybooks) using standard XSD and WSDL inclusion mechanisms.

Including and Referencing Commonly Used Elements and Types

Note: This feature applies to the EST Batch processor tools for the "bottom-up" scenario of developing new service interfaces from COBOL applications utilizing "Compiled XML conversion" technology. It is available through the Batch processor configuration files only and only for COBOL sources. The generators used in the Batch generation process must have access to the copybooks referenced in the COBOL source.

It is common in COBOL application development to create reusable sequences of code by putting them into “COPY” files (COPY books) and achieve re-use by including the same COPY book in multiple source files (via the COBOL COPY statement).

Figure 1 is a example of a typical sequence of code to re-use is data definition that repeats in multiple data structures. In this example, the two data definitions re-use the same COPY book named COMMHDR.

Figure 1. Example of COBOL Reuse of Data Definition Element
       01 departmentUpdateRequest.
           COPY COMMHDR.
           COPY DEPTBDY.

             

       01 departmentUpdateReply.
           COPY COMMHDR.
           02 updStatus pic xxx.

Figure 2 and Figure 3 show of the content of the COMMHDR copybook and DEPTBDY copybook.

Figure 2. Example of COMMHDR Copy Book
         05 commHeader.
             10 commId                  PIC 9(4).
             10 commRevDate             PIC X(8).
             10 commDigest              PIC X(40).
Figure 3. Example of DEPTBDY Copy Book
             2 member-count  pic 9(9) binary.
             2 dept-details.
               3 dept-title           pic x(35).
               3 dept-id              pic x(45).
               3 dept-seq             pic 9(4).
               3 dept-hq              pic x(75).  

Background for Including and Referencing Commonly Used Elements and Types

Prior to IBM® Rational® Developer for System z® Version 7.5, service interfaces generated from data structures that referenced COPY books required that complete XML schemas (XSDs) be generated for each data structure.

When using the input shown in Figure 1, previous versions of the Enterprise Service Tools wizards generated the output shown in Figure 4 (departmentUpdateRequest), and Figure 5 (departmentUpdateReply).
Note: For documentation purposes, only the partial schema is displayed.
Figure 4. Example of Part of Schema Generated for WSDL Interface Type for departmentUpdateRequest
     <schema ... 
targetNamespace="http://www.TST01I.com/schemas/TST01IInterface"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:cbl="http://www.TST01I.com/schemas/TST01IInterface">

      <complexType name="departmentUpdateRequest">
        <sequence>
          <element name="commHeader"
type="cbl:departmentupdaterequest_commheader"/>
          <element form="qualified" name="member_count">
            <simpleType>
              ...
            </simpleType>
          </element>
          <element name="dept_details"
type="cbl:departmentupdaterequest_dept__details"/>
        </sequence>
      </complexType>
      <complexType name="departmentupdaterequest_commheader">
        <sequence>
          <element form="qualified" name="commId">
            <simpleType>
              ...
            </simpleType>
          </element>
          <element form="qualified" name="commRevDate">
            <simpleType>
              ...
            </simpleType>
          </element>
          <element form="qualified" name="commDigest">
            <simpleType>
              ...
            </simpleType>
          </element>
        </sequence>
      </complexType>
      <complexType name="departmentupdaterequest_dept__details">
        <sequence>
          ...          
        </sequence>
      </complexType>
      <element name="departmentUpdateRequest" type="cbl:departmentUpdateRequest">
    </schema>
Figure 5. Example of Part of Schema Generated for WSDL Interface Type for departmentUpdateReply
      <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">
      <complexType name="departmentUpdateReply">
        <sequence>
          <element name="commHeader" type="cbl:departmentupdatereply_commheader"/>
          <element form="qualified" name="updStatus">
            ...
          </element>
        </sequence>
      </complexType>
      <complexType name="departmentupdatereply_commheader">
        <sequence>
          <element form="qualified" name="commId">
            ...
          </element>
          <element form="qualified" name="commRevDate">
            ...
          </element>
          <element form="qualified" name="commDigest">
            ...
          </element>
        </sequence>
      </complexType>
      <element name=" departmentUpdateReply" type="cbl:departmentUpdateReply">
        ...
      </element>
    </schema>  
As shown in Figure 4 and Figure 5, the declaration for element commHeader and for its type are duplicated for both departmentUpdateRequest and for departmentUpdateReply. The only differences are:
  1. The complex type name for each element:

    (departmentupdaterequest_commheader. VS. departmentupdatereply_commheader)

    and

  2. The namespaces for the schemas:

    (xmlns:cbl="http://www.TST01I.com/schemas/TST01IInterface. VS. xmlns:cbl="http://www.TST01O.com/schemas/TST01OInterface) .

Because a single COPY book can be used for multiple services the multiplicity of similarly typed elements may lead to unnecessary duplication of code generated for the clients from such WSDL or XSD files.

This feature allows users to specify common COPY book and common XSD types and elements that can be re-used by multiple interfaces without having to have duplicate schema content.


Terms of use | Feedback

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