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:
- The default target namespace is
http://workflow name.
- Unless it is changed explicitly, a child data element continues to
have the default namespace, even if the namespace of its parent data element is
changed explicitly.
- If you want a child data element to store data from a Web service
response, its namespace must be the same as the namespace in the Web service
schema. In other words, it must be the same as the
targetNamespace of the schema element defined in your
WSDL file. The schema element must contain the complex type from which you are
trying to map.
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:
- Provide a default value for it in the working data for the
orchestration workflow.
- Use a
Calculate step to assign it a value.
- Select a source element as an input value. (See
About Data Mapping
for details.)
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:
- Open the service WSDL file to edit it.
- Create a named type in the appropriate namespace.
- Create the attribute on the appropriate element.
- Reimport the WSDL file into
SBM Composer.
- 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:
- 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.
- Add a data element to the
WorkingData node on the
Data Mapping tab in the Property Editor for
the orchestration workflow.
- Right-click the new data element, point to
Type[String], and then select
Select from Type Library.
- 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.
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).
Suppose you want to store the
GetBuyRatingResponse value and use it later in the
orchestration workflow. You would perform the following steps:
- 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.
- 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.
- Add a new data element to the
WorkingData node and name it
GetBuyRatingResponse.
The default type is
String, and the default namespace is
http://MyOrchWorkflow (the name of the
orchestration workflow).
- Change the type to
Complex. To do this, right-click
GetBuyRatingResponse, point to
Type[String], and then select
Private Complex.
- 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.
- Add a child data element and name it
GetBuyRatingResult.
The default type is
String, and 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.
Copyright © 2007–2016 Serena Software, Inc. All rights reserved.