Creating document types from an XML schema definition
Create a document type from an XML schema to define the structure by adding fields that specify its contents and layout.
Before you begin
- Check whether you have the developer and admin roles that are assigned from the Roles page.
- Obtain the credentials to log in to the Salesforce CRM backend account.
- Create the Salesforce Account SalesforceCRM_1 in webMethods Integration. You can also create this account inline at a later step.
About this task
This task outlines how to create a document type from an XML schema Definition and use it to create Accounts in Salesforce CRM.
Procedure
- Go to Projects > Configurations > Flow service > Document Types.
- Select the option XML schema and click
OK. The Add new document type page appears.
- Provide a name and description of your document type,
- On the Source selection page, under the XML schema
source section, choose one of the available options to specify the source file for the
document type.
- To use an XML schema Definition from the internet, select the URL. Then,
type the URL of the resource. The URL you specify must begin with
http:orhttps:. - To use an XML schema Definition from your local file system, select File. Then click Browse and select the file. You can add more imported or included XML schema files.
Note: The maximum file upload size is 5 MB, which includes the primary source file and more files, if any. - To use an XML schema Definition from the internet, select the URL. Then,
type the URL of the resource. The URL you specify must begin with
- Click Next.
- In the Processing options, go to the Content model
compliances option and select one of the available options. Note: You can choose whether webMethods Integration applies strict, lax, or no content model compliance as it generates a document type. Content models define how a complex type is structured and what content it can include. Your choice affects whether webMethods Integration generates a document type from the XML schema Definition. Currently, it does not support repeating model groups, nested model groups, or any attribute. If you select strict compliance, webMethods Integration skips any schema that includes unsupported items.
- Strict
- Generate the document type only if webMethods Integration can represent the content models that are defined in the XML schema Definition. If it cannot, document type generation fails. Currently, webMethods Integration does not support repeating model groups, nested model groups, or any attribute. If you select strict compliance, webMethods Integration does not generate a document type from any XML schema Definition that containsthose items
- Lax
- When possible, generate a document type that correctly represents the content models for the complex types that are defined in the XML schema Definition. If webMethods Integration cannot correctly represent the content model in the XML schema Definition in the resulting document type, webMethods Integration generates the document type that uses a compliance mode of None. When you select lax compliance, webMethods Integration generates the document type even if the content models in the XML schema Definition cannot be represented correctly.
- None
- If you select strict or lax compliance, do one of the following to specify whether document types generated contain multiple *body fields to preserve the location of text in instance documents.
Note: If you choose strict or lax compliance, decide whether to include multiple body fields to keep the original text positions in the instance documents.- Select the Preserve text position checkbox to indicate that the document type generated preserves the locations for text in instance documents. The resulting document type contains a *body field after each field and includes a leading *body field. In instance documents for this document type, webMethods Integration places text that appears after a field in the *body.
- Clear the Preserve text position checkbox to indicate that the document type generated does not preserve the locations for text in instance documents. The resulting document type contains a single *body field in the document type. In instance documents for this document type, text data around fields is all placed in the same *body field.
Note: webMethods Integration automatically uses an internal schema parser to validate the XML schema Definition. However, the Xerces parser provides more strict validation than the internal schema parser. As a result, some schemas that the internal schema parser considers to be valid might be considered invalid by the Xerces parser.Note: You can modify the document type by clicking the Edit icon. However, the Edit action is not recommended as the edited document type asset cannot be reverted to the original state. For example, if you change any field name such as Area to Province you cannot reset it to Area again.Also, you can see that other document types are created automatically from the same xsd source file. This is because if an element in the XML schema Definition is a complex type, webMethods Integration creates the document type that defines the structure of the preceding complex type automatically, along with the main document type. For example, in the EmployeeDetails.xsd after this file, the field address is a complex type containing Doorno, street, city, and pincode as its fields.
Then two document types are created when we create the document type with this xsd source. One document type is the main document type, Employeedetails and the other document type is docTypeRef_AddressType, which represents the structure of the complex type.
Note:- If you have selected strict compliance and webMethods Integration cannot represent the content model in the complex type accurately, webMethods Integration does not generate any document type.
- If you have selected lax compliance and indicated that webMethods Integration should preserve text locations for content types that allow mixed content (you selected the Preserve text position checkbox), webMethods Integration adds *body fields in the document type only if the complex type allows mixed content and webMethods Integration can correctly represent the content model declared in the complex type definition. If webMethods Integration cannot represent the content model in a document type, webMethods Integration adds a single *body field to the document type.
- If the XML schema Definition contains an element reference to an element declaration whose type is a named complex type definition (as opposed to an anonymous complex type definition), webMethods Integration creates a document type for the named complex type definition only if it is referred multiple times in the schema.
- webMethods Integration uses the prefixes declared in the XML schema or the ones you specified as part of the field names. Field names have the format prefix: elementName or prefix: @attributeName.
- If the XML schema does not use prefixes, webMethods Integration creates prefixes for each unique namespace and uses those prefixes in the field names. webMethods Integration uses “ns” as the prefix.
- If the XML schema Definition contains a user-specified namespace prefix and a default namespace declaration, both pointing to the same namespace URI, webMethods Integration uses the user-specified namespace prefix and not the default namespace.
- If the namespace prefix in the XML schema and the default namespace point to the same namespace URI, webMethods Integration gives preference to the user-specified namespace prefix over the default namespace.
- Click Next.
- On the Select root nodes page, select the elements that you want to use as the root elements for the document type. The resulting document type contains all of the selected root elements as top-level fields in the generated document type.
- Successfully creates the document type based on the selected settings and the provided XML schema Definition.
- Go to the Flow Services page and click the Add icon to create a new flow service.
- Enter the name CreateAccountsDocType and provide a description for the flow service.
- Click the I/O icon and define the input and output fields.
- Select the document reference and click Save.
- Select Salesforce CRM and link the SalesforceCRM_1 account.
- Click the View/Edit Pipeline icon and map the input and output fields.
- Close the mapping page by clicking the Close icon
- Click the Run icon and enter the input values.
- Click Run and inspect the results.