About Complex Types and Namespaces

Complex types differ from simple types in that complex types can have child data elements and attributes, while simple types cannot. Complex types can be named or anonymous. All types except anonymous types are identified by their name and target namespace. Anonymous complex types do not have names.

You can view the name and namespace for a data element by switching from mapping mode to properties mode on the Data Mapping tab in the Property Editor for an orchestration workflow or Service step. To switch modes, click the vertical bar near the right side of the tab.

You can use the Select Library Type Dialog Box to associate a named type with a data element. This dialog box contains the named types defined by the Web services that were imported into the orchestration workflow. In the orchestration workflow Property Editor, the NamedType, NamedType Namespace, and Namespace are read-only. You cannot manually add a child element to a data element with a named type, even if it is a complex type.

Note the following points about anonymous complex types:

Element and Attribute Mapping

In an XML schema, by default, elements are required and attributes are optional. If an element or attribute is optional, no element or attribute is created; therefore, the element or attribute will have no value. If you need to map that element or attribute, you must initialize it with a value by doing one of the following:

SBM Composer does not distinguish elements from attributes; both are presented as data elements in the Data Mapping tab of an orchestration workflow or Service step Property Editor. To see elements and attributes, refer to the original schema definition, which is imported into SBM Composer as a service WSDL file. In this file, an attribute is declared as part of a complex type. The use attribute is used to specify that it is required. For example:
<xs:attribute name="myattr" type="xs.string" use="required"/>

If an attribute is contained within a named type, the attributes will be presented as child data elements on the Data Mapping tab, and you can initialize them as described above. However, if an attribute is contained within an anonymous type, it will not appear on the Data Mapping tab, and you will not be able to create it there as a child of a data element. To work around this situation, do the following:

  1. Open the service WSDL file to edit it.
  2. Create a named type in the appropriate namespace.
  3. Create the attribute on the appropriate element.
  4. Reimport the WSDL file into SBM Composer.
  5. Initialize the attribute using one of the three methods listed above.

Example: Named Type

A complex data element associated with a named type inherits its namespace and children data elements from the named type. For example, suppose you do the following:
  1. Add the sbmappservices72 Web service to the process app. To do so, right-click the Web Services heading in App Explorer, and select Add New Service. In the Web Service Configuration dialog box that opens, navigate to the sbmappservices72.wsdl file, and then click OK. This file is in the installDir\Application Engine\webservices\bin directory.
  2. In the orchestration workflow Property Editor, select the Data Mapping tab.
  3. Right-click the WorkingData step input, select Add New, and then select Select from Libray Type.
  4. In the Select Library Type Dialog Box that opens, find and select TTItem) and then click OK.

    As shown in the following illustration, the Namespace value is inherited from the NamedType Namespace value.

image

Example: Anonymous Type

For a complex data element with an anonymous type, you must create the structure manually and specify the correct namespace. You get the information you need from the WSDL file for the Web service.

The following illustration of shows part of a WSDL file. This file includes the target namespace (urn:SerenaSampleTickerService) and some of the elements that can be added to the structure (GetBuyRating, GetBuyRatingResponse, GetTickerSymbol).

Snippet from WSDL file

Suppose you want to store the GetBuyRatingResponse value and use it later in the orchestration workflow. You would perform the following steps:
  1. Add the SerenaSampleTickerService Web service to the process app. To do so, right-click the Web Services heading in App Explorer, and then select Add New Service. In the Web Service Configuration dialog box that opens, in the WSDL box, type http://serverName:8085/Ticker/services/SerenaSampleTickerService?wsdl and then click OK.
  2. Add a Service step to the orchestration workflow. On the General tab in the Property Editor for the step, select SerenaSampleTickerService from the Service list, and select GetBuyRating from the Operation list.
  3. Add a new data element (complex type) to the WorkingData node and name it GetBuyRatingResponse.

    Data Mapping tab of MyOrchWorkflow orchestration workflow Property Editor

    The default namespace is http://MyOrchWorkflow (the name of the orchestration workflow).

  4. Change the namespace to the targetNamespace shown in the WSDL file (urn:SerenaSampleTickerService). To do this, simply copy and paste the namespace into the Namespace box.

    Data Mapping tab of MyOrchWorkflow orchestration workflow Property Editor

  5. Add a child data element and name it GetBuyRatingResult.

    Data Mapping tab of MyOrchWorkflow orchestration workflow Property Editor

    The namespace was inherited from the parent data element. The namespace matches the targetNamespace in the WSDL file.
    Important: If the namespace does not match the targetNamespace in the WSDL file, you must change it manually.