Please enable JavaScript to view this site.

Altova MapForce 2020 Enterprise Edition

In mappings that contain Web service calls, if the context allows it, the same Web service may be called multiple times, which you will normally want to avoid. Consider the following cases:

 

If the connection to the Request item of the Web service component carries a sequence of values, then the Web service will be called multiple times, once for each item in the sequence.

If a Web service is inside a user-defined function, and if the UDF gets called multiple times for the duration of the mapping execution, then the Web service will be called at least as many times. This can be avoided by configuring the UDF settings. For details, see User-Defined Functions.

You will typically want to connect the Response item of a Web service to a target item that:

ois expected to be created only once (for example, a simple output component, or the top item of some complex target component)

ois not in a parent context that demands multiple iterations of the item (and thus multiple Web service calls, potentially).

 

With respect to the third case above, it could lead to a Web service being called multiple times, even though the mapping output would be the one expected. For example, the Web service illustrated below is called twice because of the missing connection from Response to Rows.

mf_semantics_09

As usual, mapping execution begins with the target root item (Rows, in this case). Rows does not have a connection, so MapForce proceeds down the hierarchy. To populate the statusCode target item, the first call to the Web service is made. Next, the mapping must populate the body item, so it makes the second call to the Web service. If there were more children of Rows connected to the Web service, a new call would occur for each.

 

The reason is that, in the mapping above, neither statusCode nor body have an explicit parent context (in other words, their parent is not connected to a source item). As a consequence, they cannot reuse any data from their parent context and must retrieve it individually from the source component, which in this case happens to be a Web service. This problem is easily solved by drawing a connection from Response to Rows, as shown below:

mf_semantics_10

Thanks to the connection between Response and Rows, the Web service is now called only once. After the first call occurs, all the Web service data is in the current context and available to children of Rows, so no more redundant Web service calls take place.

© 2020 Altova GmbH