Different Types of Assigns

The assign element is a BPML construct you can use to perform simple assignment operations within a service call. You can also use assign statements outside of any operation, input, or output tags.

Performing a simple assignment operation within a service call is illustrated in the first example (see Input and Output Examples). Sometimes called top-level assignment, this method enables you to manipulate the process data directly, outside the service call in a process rather than within the service step.

Within Sterling B2B Integrator, the Assign service configuration is available for this purpose, and in the GPM, it is represented as the Assign activity, available as an icon from the BPML stencil. This topic discusses the assign element, not the service or activity, but it is important to note that top-level assignments follow the same conventions outlined here.

Note: If you are configuring a service in the GPM rather than by direct coding, and you want to include an assign element in the service configuration, add it to the parameters on the Message To Service or Message From Service tab, as appropriate. To add the element, click Advanced.
Note: When constants are used in the service configuration, the output mapping behaves differently:
  1. If all parameters are constants, the service ignores the output mapping and retains the parameters as provided. Consequently, input mapping is not supported under these conditions.
  2. If at least one constant includes a from attribute in the output mapping, all constants are considered in the output mapping. For Example:

    <operation>
      <participant name="AssignService"/>
      <output message="xout">
        <assign to="Dad" from="string('Terry')"/>
        <assign to="Daughter">Rikki</assign>
      </output>
      <input message="xin">
        <assign to="Chadwick" from="*"/>
      </input>
    </operation>
    

    Output:

    <?xml version="1.0" encoding="UTF-8"?>
    <ProcessData>
      <Chadwick>
        <Dad>Terry</Dad>
        <Daughter>Rikki</Daughter>
      </Chadwick>
    </ProcessData>
    
  3. When the input mapping is empty or the to attribute is set to ., the service copies all constants to the instance data.