Using Eclipse plugins

COBOL Transformers Generation for an Adapter

The wizard is started from the package explorer, by right clicking on the previously generated XML Schema:

Figure 3.1. Adapter COBOL Transformers generation menu

Adapter COBOL Transformers generation menu

The next page allows you to specify which elements from the source XML Schema will need to be bound. All elements are displayed here but if you select a parent element, this will automatically select all children for you, so all you need to do is to select root elements:

Figure 3.2. Adapter COBOL Transformers generation parameters screen

Adapter COBOL Transformers generation parameters screen

In the Adapter case, the mainframe program expects a Dfhcommarea and also produces a Dfhcommarea so that’s the only element we need to select.

The first options button allows you to customize the JAXB classes that will be generated.

The second options button allows you to specify additional Transformers to be generated such as XML and JSON Transformers.

When you click the finish button, an ant script with a name similar to build-coxb-CustomerService.xsd.xml is generated and launched. There are two different java packages that are generated by the ant script:

  • com.legstar.test.coxb.customerservice contains JAXB classes as generated by Sun’s JAXB XJC utility but with special COBOL annotations as shown on the next screen.

  • com.legstar.test.coxb.customerservice.bind contains the Transformers classes that can be used for fast marshaling/unmarshaling. Using these classes, there is no need for reflection on the JAXB classes to get the COBOL meta-data at runtime.

Figure 3.3. Adapter COBOL Transformers generation screen results

Adapter COBOL Transformers generation screen results

The Using generated tranformers section gives examples of code you could write to run Transformers.

COBOL Transformers Generation for a Proxy

The wizard is started from the package explorer, by right clicking on a previously generated XML Schema and then selecting LegStar->Generate Transformers:

Figure 3.4. Proxy COBOL Transformers generation menu

Proxy COBOL Transformers generation menu

In this case, the root structures we are interested in are Search and SearchResponse, which are the wrapper elements expected and produced by the target Web Service. We select them both.

Figure 3.5. Proxy COBOL Transformers generation screen parameters

Proxy COBOL Transformers generation screen parameters

Because Microsoft uses the same names for both Elements and Complex Types, JAXB may complain about name conflicts. To avoid this, you can customize JAXB using the upper options button and specify that all Complex Types should be suffixed with characters "Type":

Figure 3.6. Proxy COBOL Transformers generation screen JAXB options

Proxy COBOL Transformers generation screen JAXB options

After you click finish, two Java packages are created, one for JAXB classes with COBOL annotations and one for the optimized Transformers classes.

Figure 3.7. Proxy COBOL Transformers generation screen results

Proxy COBOL Transformers generation screen results

The Using generated tranformers section gives examples of code you could write to run Transformers.