webMethods Flow Tutorial - No.3 Create Document Types

Duration:  15 minutes

Integration Server (IS) Document Types are simply reusable data structures. They often represent an XML Schema definition. In this tutorial you will create two Document Types: one manually, and the second by an external artifact (in this case an XML Schema Definition).

Prerequisites #

This tutorial builds on concepts, techniques, and objects covered previously in:

Step Outline #

You create Document Types either by:

  • Manually creating the Document Type and defining its data structure
  • Referencing an external source that defines a document structure, such as an XSD file

Step 1: Manually Create a Document Type #

In this step: You will create a document type and define the data elements that it contains.

To manually create a Document Type:

  • From Designer, right-click on the FLOW_Tutorial.docs folder and select New > Document Type

  • In the New Document Type dialog, enter OrderRequest in the Element name field and click the Finish button:

Designer opens the new OrderRequest Document in the Document Type Editor. You can now add elements to the Document Type.

Step 2: Add Elements to the Document Type #

In this step: You will add elements to define the structure of the new Document Type.

  • Expand the Palette on the right side of the Document Type Editor.

Insert a Document element into your OrderRequest Document Type.

  • From the Palette, drag a Document onto the white space of the Document Type Editor view:

Designer adds the new Document element to your Document Type.

  • Name the new element Request:

  • Insert a String named Sender and a Document List named Orders as children of the Request root element (drag and drop them on top of the Request document to add them under the Request document):

Note: You may change the order and indentation/hierarchy of the Document Type elements by using the Shift buttons on the Designer toolbar:

  • Insert the following String elements as children of the Orders Document List:

o OrderID

o SKU

o UnitPrice

o Quantity

  • Collapse and expand the Orders node to ensure that the child nodes are indented correctly
  • Select the Save icon in the Designer toolbar:

Note: You may add elements (variables, fields) to your Document Type in several ways:

1) Click-and-click: click on a variable type such as String in the Palette and then click again on the white space area of the Document Type Editor

2) Click-and-drag: click on a variable type such as String in the Palette and then drag it onto the white space area of the Document Type Editor

3) Toolbar insert button: instead of using the Palette on the right side of the Document Type Editor, you may use the Insert button

at the top of the window in the Designer toolbar (use the drop-down arrow for the same options as the Palette, or click the button for the same variable type as previously added (default is a String))

4) Right-click: right-click on the white space of the Document Type Editor, and choose Insert-> from the context menu

5) Drag from Package Navigator: you may also drag Document Types directly from the Package Navigator view (inserted as a Document Reference)

6) Copy/paste: elements may be pasted into your Document Type, having been cut/copied from other parts of a Document Type; copied from the Package Navigator view (as a Document Reference); or copied from the input/output of services, the Pipeline view of a flow service, or the service debugger

The new FLOW_Tutorial.docs:OrderRequest document type is now ready for use.

Step 3: Create a Document Type from an XML Schema Definition #

You can create Document Types from external sources, such as XML Schema, DTDs, or even XML instances.

In this step: You will create a Document Type from an XSD (XML Schema Definition) file. To create a Document Type from an XSD:

  • Right-click on the FLOW_Tutorial.docs folder and select New > Document Type:

In the New Document Type wizard, enter OrderResponse in the Element name field and click the Next button:

Important: You must click Next to import a Document Type from a source such as a schema. Clicking Finish will create an empty Document Type.

The New Document Type wizard prompts you to select a source for the new Document Type.

  • Select XML Schema, then click the Next button:

  • Click the Browse… button to select the XSD file:

  • In the Select Processing Options dialog, accept the defaults and click the Next > button:

The New Document Type wizard prompts you for the root node of the Document Type and for the type of schema processing to perform.

Note: Response is the only available node in this XSD.

  • Accept the defaults and click the Finish button:

Designer generates the new Document Type and opens it in the editor:

Note: When you create a new Document Type from an external source, Designer automatically creates a new IS Schema type for validation purposes.

  • Expand the Response Document Type in the editor to examine its structure:

Conclusion #

You have created IS Document Types using two different methods. You will use these Document Types in subsequent tutorials.

To import the solution of this tutorial download Completed Export of 3. Create Document Types.zip and follow the directions in the Import an IS Package tutorial


Read in this series: