Input and output fields

In webMethods Integration, input and output fields in flow services are explicitly declared to define the structure of data exchanged between services, helping can ensure clarity and consistency in message processing.

The Define I/O feature specifies the input and output fields for a flow service. You can define the input and output fields from the Defined input and output fields screen. You can access the screen by clicking the Define I/O icon from the Flow Editor toolbar.

The Defined input and output fields page has two tabs:

Input Fields
Defines the fields that the flow service requires as input.
Output Fields
Defines the fields that the flow service returns to the client or calling program.

You can declare the fields of a flow service in one of the following ways:

Add new set
Specify the input and output fields manually.
Document Reference
Specify the input and output fields through a document type. When you assign a document type, you cannot add, modify, or delete the fields. For more information, see Declaring Fields using Document Reference.
Note: The declared input and output fields are automatically displayed in the Pipeline Input and Pipeline Output columns of the Pipeline page. The field names are case-sensitive.

Input fields

  • Specify all inputs that a calling program must supply to this flow service. For example, if a flow service starts two other flow services, one that takes a field that is called AcctNum and another that takes OrderNum. You define both AcctNum and OrderNum as input fields for the flow service.

Note: The purpose of declaring input fields is to define the inputs that a calling program or client must provide when it starts this flow service. You do not need to declare inputs that are obtained from within the flow service itself. For example, if the input for one flow service is derived from the output of another flow service, you do not need to declare that field as an input field.
  • When possible, use field names that match those names that are used by flow services. Fields with the same name automatically link in the pipeline, reducing the need for manual data mapping. If you use different names, you must manually link them.
  • Avoid by using multiple inputs with the same name. Although the application supports defining multiple input fields with the same name, during execution, one field might overwrite the other. This causes incorrect processing within the flow services or by other flow services that start this flow service.
  • Make sure the fields match the data types the flow service expects. For example, if the flow service expects an integer that is named AcctNo, define that input field as an integer.

Output fields

  • Specify all output fields that you want this flow service to return to the calling program or client.
  • Specify all output fields that you want this flow service to return to the calling program or client.
  • Make sure that the names of output fields match those names that are used by the flow services that produce them. Like input fields, if the specified names do not match the names that are produced by the flow service’s constituent services, you must manually link them. Avoid having multiple outputs with the same name. Although the application interface supports defining multiple output fields with the same name, the flow services that process these fields might not function as expected.
  • Make sure that the fields match the data types of the fields they represent in the flow service. For example, if a flow service produces a string that is called AuthorizationCode, make sure that you define that variable as a string.

Declaring fields manually

You can declare fields manually in one of the following ways:

  • Using Add a new set
  • Loading through XML or JSON

Input and output field validations

Use the Input and Output Field Validations feature to validate the input and output fields at run time. While declaring the input and output fields, you can specify constraints such as the minimum value that a field can accept and the maximum length that a string can have. At run time, webMethods Integration validates the values and if the constraints are not satisfied, then the flow service execution fails.

You can enable this feature using the options Validate input and Validate output in the Input Fields and Output Fields tabs of the Define input and output fields page.

Value set

When running a service, you might need to submit input values. To run the same flow service again with the same inputs, use the previously stored value instead of entering the values manually.

Include empty values for string types

The Include empty values for string types option in flow services help ensure that empty string variables ("") are included in the output and passed through the pipeline. By default, empty strings are skipped, so the variables do not appear in the pipeline.

The Include empty values for string types option is enabled by default, and its setting is not persisted when toggled or off. Enable or disable this option based on the wanted outcome. Enabling the option saves the string variable with empty values, while disabling it saves the string variable with null values.

Key points to consider when using the Include empty values for string types option in flow services:

  • With the option Enabled (Default behavior).
    • If you do not provide a value for a string field in the input pipeline, its value defaults to an empty string ("") at run time.
  • With the option Disabled.
    • If you do not provide a value for a string field in the input pipeline, its value defaults to null at run time.
Note: The Include empty values for string types setting also applies to map set steps in flow services, making sure that string fields without provided values are treated as empty strings ("") instead of null.

Guidelines for defining input and output fields

Declaring input and output fields for a flow service enhances best practices for these reasons.

  • Declaring fields makes the flow service’s input and output fields available in the pipeline.
  • Declaring fields allows:

    • Linking data to and from the flow service.

    • Assigning default input values.

    • Running the flow service with specified initial input values.

  • Declaring fields makes the input and output requirements of your flow service that is known to that other developers might want to call your flow service from their programs.