Defining an XML document by using an XML schema

This use case explains how to define an XML document from XML schema.

Before you begin

Ensure that you have:

  • An existing project in IBM® webMethods Integration.
  • XML document structure (document type, schema, and so on) that is defined in the system.

About this task

The use case starts with an XML schema that you use to define an XML document and ends when you successfully create the XML document.

In this example, define an XML document purchaseorder1 that is project-aware of the project B2B_Test in IBM webMethods Integration and uses an XML schema POAccept.xsd.

Procedure

  1. In webMethods B2B from the side navigation menu, click Assets > Business document.
  2. Click Add document icon and select XML.
  3. Specify the following details:
    • Name, type purchaseorder, a name for the XML document.
    • Description, optional. Provide a brief description for the XML document.
  4. Select the project B2B_Test and click Next.
  5. Select No to create an XML document without referring to an existing document type from the selected project.
  6. Select an XML schema.
  7. Select File as the XML schema source. Provide a URL on which an XML schema source is hosted.
  8. Provide the XML schema file by dragging and dropping the required file in the provided space. Alternatively, either browse for the required file to upload it, or provide the XML schema URL. Ensure that you also have the user credentials to access the URL-hosted schema.
    Note: The XML schema file size must be less than or equal to 1 MB.
  9. Select the Content model compliance. The content model provides a formal description of the structure and allows the content to be of a complex type. Specify whether webMethods B2B enforces the following model compliance when it generates the document type:
    • Strict. Generates the document type only if webMethods B2B can represent the content models that are defined in the XML schema definition correctly. Document type generation fails if webMethods B2B cannot accurately represent the content models in the source XML schema definition.
    • Lax. Generates the document type even if the content models in the XML schema definition cannot be represented correctly.
    • None. Generates the document type that does not necessarily represent or maintain the content models in the source XML schema definition.
  10. Select Preserve text position. Specifies that the document type generated for a complex type that allows mixed content to preserve the location of text in instance documents. The resulting document type contains a body field after each field and includes a leading body field.
  11. Select Validate schema using Xcerces. webMethods B2B uses the Xerces Java™ parser to validate the XML schema definition and click Next.
  12. In the Select root node section, select the element PurchaseOrderAcceptance that you want to use as the root element for the document type.

    Select multiple elements by pressing the Ctrl key. If webMethods B2B determines that the XML schema definition is invalid, the Select root node displays an error message to that effect. Click Cancel to cancel the attempt to create a document.

  13. Click Save.

Results

The XML document is created. View this XML document in the list of available documents on the Business documents page.

What to do next

  • After you add the XML document, manually extract the senderID and receiverIDs so that webMethods B2B can recognize the documents.
    Note: After adding XML documents using DTD or XSD or a sample XML, you must explicitly add the processVersion attribute in the pipeline matching step under Identifiers for each document. Only then, webMethods B2B recognizes RosettaNet messages.
  • Activate the XML document and test it.

    With this use case, the respective document type is also created on webMethods Integration.

Alternate Flow
  • To update the XML document, click Edit icon on the document details page. You can update the name, description, project, and document type.
  • Navigate to the respective pages to edit the Identifiers, Attributes, Namespaces, and Options.