Working with Variables
A variable can be a String, String list, String table, document, document list, document reference, document reference list, Object, or Object list. Variables are used to declare the expected content and structure of service signatures, document contents, and pipeline contents. In addition to specifying the name and data type of a variable, you can set properties that specify an XML namespace, indicate whether the variable is required at runtime, and indicate whether the variable can be null at runtime.
Select a variable in the editor to set general properties and constraints for the variable. Specific properties in the Properties view are enabled or disabled, depending on the type of variable you have selected.
Creating a Document Reference or a Document Reference List Variable
About this task
Keep the following points in mind when using IS document types to create document references or document reference lists.
- If you are creating a document reference or document reference list field based on an IS document type, you cannot directly add, delete, or modify its members in the Input/Output tab. To edit the referenced document or document list, select it in the Package Navigator view, lock it, and then edit its fields in the editor.
- You can also add a document reference by dragging an IS document type from the Package Navigator view to the Document Type editor.
To use a document type to build a document reference or document reference list
Procedure
Using XML Namespaces and Namespace Prefixes with Variables
You can assign an XML namespace and prefix to a variable by specifying a URI for the XML namespace property and by using the following format for the variable name:
prefix:variableName
This creates a QName for the variable in which portions of the variable name are used as the prefix and local name and the value of the XML namespace property is the namespace name. For example, suppose that a variable is named eg:account and the XML namespace property is set to http://www.example.com. The prefix is eg, the localname is account and the namespace name is http://www.example.com.
When generating XML Schema definitions and WSDL documents, Integration Server uses the value of the XML Namespace property along with the variable name (the prefix and local name) to create a qualified name (QName) for the variable.
Integration Server also uses namespace prefixes assigned to variables in an IS document type when converting an XML document or XML node to a document (IData object). Integration Server obtains the namespace prefix to be used in the resulting document (IData) from the variable name in the document type rather than relying on the prefix present in the actual XML node. For example, suppose that Integration Server converts an XML node to a document (IData) using a document type to specify the structure to be imposed on the resulting document (IData). The document type contains a field named eg:account for which the XML Namespace property is set to www.example.com. The XML node contains an element named otherPrefix:account in which otherPrefix is defined to represent the namespace http://www.example.com. The resulting document (IData) contains a field named eg:account based on the document type field instead of otherPrefix:account as it appears in the original XML node.
Guidelines for Using XML Namespaces and Prefixes with Web Service Descriptors
Use the following guidelines for assigning XML namespaces and prefixes to variables that will be used with web service descriptors:
- If an IS service signature contains a variable name in the format prefix:localName, you must specify a URI as the value of the XML namespace property for that variable.
- If an IS service is exposed as an RPC/Literal or RPC/Encoded web service operation, then the top-level field name in the service signature should not be in the format prefix:localName and should not be associated with an XML namespace.
- If an IS service is exposed as a Document/Literal web service operation, then any field name in the service signature can be in the format prefix:localName, but it must also be associated with an XML namespace.
Assigning XML Namespaces and Prefixes to Variables
About this task
Keep the following points in mind when assigning XML namespaces and prefixes to a variable:
- The variable name must be in the format: prefix:variableName
- You must specify a URI in the XML namespace property.
- Do not use the same prefix for different namespaces in the same document type, input signature, or output signature.
To assign an XML namespace and prefix to a variable
Procedure
- In the editor, select the variable to which you want to assign an XML namespace.
-
In the Properties view, click the
XML
namespace browse button (
) and then enter a value for the XML namespace.
- To assign a prefix to a variable, rename the variable to use the following format in which the namespace prefix precedes the variable name: prefix:variableName.
- Click OK.
- Click File > Save.
Assigning Display Types to String Variables
About this task
To assign a string display type to a String variable
Procedure
About Variable Constraints
In pipeline, document, and input/output validation, the blueprint used for data validation requires constraints to be applied to its variables. Constraints are the restrictions on the structure or content of variables. You can apply the following types of constraints to variables:
-
Structural
constraints specify the existence and structure of variables at run time. For
example, if the flow service in which you are validating the pipeline processes
a purchase order, you might want to check that values for the
purchaseOrderNumber,
accountNumber, and
customerName
variables exist at run time.
For document and document list variables, you can also specify the structure of the variable; that is, you can specify what variables can be contained in the document (IData object) or document list (IData[ ] object) at run time. For example, you could specify that the lineItem document variable must contain the child variables itemNumber, quantity, size, color, and unitPrice. You could also specify that the lineItem document can optionally contain the child variable specialInstructions.
-
Content
constraints describe the data type for a variable and the possible values for
the variable at run time. You can apply content constraints to String, String
list, String table, Object, and Object list variables.
When you specify a content constraint for a String, String list or String table variable, you can also apply a constraining facet to the content. A constraining facet places limitations on the content (data type). For example, for a String variable named itemQuantity, you might apply a content constraint that requires the value to be an integer. You could then apply constraining facets that limit the content of itemQuantity to a value between 1 and 100.
You can use simple types from an IS schema as content constraints for String, String list, or String table variables.
For pipeline and document validation, the IS document type used as the blueprint needs to have constraints applied to its variables. For input/output validation, constraints need to be applied to the declared input and output parameters of the service being validated. For more information about data validation, see Performing Data Validation.
Considerations for Object Constraints
Constraints for Object and Object list variables correspond to Java classes, whereas constraints for String variables correspond to simple types in XML schemas. When you apply constraints to Objects and perform validation, the data is validated as being of the specified Java class. For details on the Java classes you can apply to an Object or Object list, see Java Classes for Objects.
A constrained Object is validated when one of the following occur:
- A service runs with the Validate input or Validate output check box selected on the Input/Output tab.
- A service runs via the INVOKE step in a flow service with the Validate input or Validate output properties set on the INVOKE step.
- The pub.schema:validate service runs.
- A document is published. When this occurs, the contents of the document are validated against the specified document type.
- During debugging, when you enter values for a constrained Object or Object list in the Input dialog box.
- When
you assign a value to an Object or Object list variable in the Pipeline view
using
on the toolbar.
Applying Constraints to a Variable
About this task
- The
Required property appears for
variables in document types if one or more of the following are true:
- The document type was created using a version of Integration Server prior to version 8.2.
- The document type was created using Developer.
- The Model type property of the document type is Unordered.
- The Min occurs, Max occurs, and Model type variable properties are display-only. These properties appear only for a variable in an IS document type with a Model type property value of Sequence, Choice, or All.
- Variables defined in an IS document type with a Model type property value other than “Unordered” cannot be modified.
To apply constraints to a variable
Procedure
Customizing a String Content Type
About this task
When you customize a type, you actually create a new content type. Designer saves the changes as a new content type named contentType_customized. For example, if you customize the string content type, Designer saves the new content type as string_customized.
When customizing a content type, keep the following points in mind:
- When you edit the constraining facets, you can only make the constraining facet values more restrictive. The constraining facets cannot become less restrictive.
- The constraining facets you can specify depend on the content type. Note that content types and constraining facets correspond to datatypes and constraining facets defined in XML Schema. For more information about constraining facets for a datatype, see the specification XML Schema Part 2: Datatypes (http://www.w3.org/TR/xmlschema-2/).
- The customized content type applies only to the selected variable. To make changes that affect all variables to which the content type is applied, edit the content type in the IS schema. (String content types are simple types from IS schemas.) For more information about editing simple type definitions, see About Editing Simple Type Definitions.
To customize a content type
Procedure
Viewing the Constraints Applied to Variables
Designer displays small symbols next to a variable icon to indicate the constraints applied to the variable. Designer displays variables in the following ways:
Variable | Constraint status | Variable Properties |
---|---|---|
![]() |
Required field. | The Required property is set to True. |
![]() |
Optional field. | The Required property is set to False. |
![]() |
Required field with content type constraint. | The Content type property specifies an IS schema or XML schema. |
![]() |
Optional field with content type constraint | The Required property is set to False and the Content type property specifies an IS schema or XML schema. |
![]() |
Required field with default value. | The Required property is set to True. The variable has a default value, but you can override this default value with any other valid values while executing the service or mapping the variables. |
![]() |
Required field with fixed default value of null. | The
Required property is set to
True. You cannot override the default null value assigned to the variable by
mapping it to another variable or by assigning any input values to this
variable during service execution.
Note: By default,
Designer hides the variables with this constraint. To display
these variables in the content and structure of service signatures, document
and pipeline contents, and in the Run Configurations, Enter Input for
serviceName, and Enter Input
for
variableName dialog boxes,
select the
Show
variables with fixed values property on the
Service Development Preferences page.
|
![]() |
Required field with fixed default value. | The
Required property is set to
True. You cannot override the default value assigned to the variable by mapping
it to another variable or by assigning any input values to this variable during
service execution.
Note: By default,
Designer hides the variables with this constraint. To display
these variables in the content and structure of service signatures, document
and pipeline contents, and in the Run Configurations, Enter Input for
serviceName, and Enter Input
for
variableName dialog boxes,
select the
Show
variables with fixed values property on the
Service Development Preferences page.
|