Creating an XML Schema

In this section:

How to:

You can create XML request and response schemas for the Microsoft Dynamics CRM 2011 entities that you want to use with your adapter. Optionally, you can store the schemas in a folder (directory) on your file system, using the iWay Explorer export feature.

The iWay Application Adapter for Microsoft Dynamics CRM 2011 On-Premises supports the following schema types:

When schemas are generated for Create, Read, Update, and Delete (CRUD) operations, the adapter retrieves metadata with attributes from Microsoft Dynamics CRM 2011. For the current entity and its operation, the adapter checks all attributes in the metadata and transforms them to a schema. This allows all entity customizations to be reflected in a schema because the metadata is generated in real time at the moment when the schema is generated.

Schemas for advanced operations (other than CRUD operations) are generated based on MS CRM SDK classes. For more information, see Schemas for Advanced Operations.

There are several standard elements that are common to every XML schema, which are listed and described in the following table.

Standard Element Name

Description

entity.operation

Root element for input (request) schema that consists of a logical entity name and an operation separated by a period (.). For example:

account.Create

entity.operation.Response

Root element for output (response) schema that consists of a logical entity name, operation, and the suffix Response separated by a period (.). For example:

account.Delete.Response

EntityList

The container for entities.

Entity

The container for entity name and parameters.

Params

The container for entity parameters, which are taken from the metadata.

The entity is the logical name that is used by Microsoft Dynamics CRM 2011. A name may not always appear as it is used in the GUI. For example, kbarticle, account, and salesorder.

The schema name matches the operation name in the entity tree. For example, the Create Account operation is named Create.

To view a sample XML schema, see:


Top of page

x
Procedure: How to Create an XML Schema

To create an XML schema:

  1. Expand the connected target node and locate the method for which you want to create XML request and response schemas.

    For example, for Microsoft Dynamics CRM 2011, expand Account and select Create.

  2. Right-click Create, and click Open Schemas from the menu.

    iWay Explorer creates request and response schemas for the selected method. By default, the Response tab in the right pane is selected (active), and iWay Explorer displays the response schema in that pane.

  3. In the right pane, click the Request tab to display the request schema.

Top of page

x
Procedure: How to Export an XML Schema

To export an XML schema:

  1. Right-click the method whose schemas you want to export, for example, Create.
  2. From the menu, click either Export Request Schema or Export Response Schema.

    The Save As dialog box opens, as shown in the following image.

  3. Select the project folder in which to store the exported schema. By default, iWay Explorer stores project files in your workspace folder.
  4. Type a name for the exported schema using the following naming convention: entityname_operation.xsd. For example, account_create. By default, the file name extension is .xsd.
  5. Click OK when you are done.

    iWay Explorer stores the exported schema in the project folder that you selected, using the name that you supplied. For example:


Top of page

x
Working With Adapter Schemas

When an XML schema is generated using iWay Explorer based on a selected entity and associated operation, the XML schema will also be used to create or validate an XML instance during run time. It is helpful to understand the structures of the XML schema and their relation to MS CRM parameters.

The beginning (top) of the XML schema is represented by an element that identifies the entity and operation (for example, account.Create). The sub-sequence element called EntityList allows multiple instances of the same entity and operation to be specified in the same XML instance.

The next element is called entityType and has a sub-sequence element called Params that contains the message parameters. These are the attributes that are displayed in the iWay Explorer tree and property views. Only valid parameters for the message type are represented in these parameters. If a parameter is required, it has a minOccurs attribute set to 1 (minOccurs="1"). If a parameter is not required, it has a minOccurs attribute set to 0 (minOccurs="0").

Note: While parameters are optional, if you put a parameter name in a request document, you are required to provide a value for it, even if it is not required.

Each attribute has a name, a display name, and a description, which may reflect localization if it is applied. If a parameter is a basic MS CRM data type, then its type and length are represented in the restriction element. If a parameter has a droplist type, then the values for the droplist selection are represented lower in the schema, within the advanced option section. The RelatedEntities element allows specification of the global unique ID of other entities that may be referenced in this request.

The MS CRM optional parameters Suppress Duplicates and Calculate Match codes Synchronously are advanced operations to control processing of the message.

While the XML schema for an entity and operation may contain 100 fields or more, the XML instance may have only a small number of fields necessary for the current operation. To view sample XML request and response schemas for MS CRM, see:


iWay Software