Skip to content

Sequential Rewrite Write Response

When a webservice creates or updates data, it typically replies with the fully populated record. Sequential rewriting assumes the response is in the same order as the data that was sent.

The JSON Writer rewrites sequentially in the same way, with JPath in place of XPath and no namespaces to declare.

IMan walks the response in step with the IMan data: from the top-most node inwards to the children, then back out and on to the next record.

Where the service does not guarantee that order, use Keyed Rewrite instead. If the response has been re-ordered, matching by position writes each record's values onto the wrong record, and IMan reports no error.

Configuring the response

IMan parses the response using XPath. You configure it the way you configure an XML Reader: an Initial Path, a Transaction Path per transaction and a Field Path per field.

The IMan dataset beside the webservice response, showing how the response is walked depth first in lockstep with the data — the first order to the first order element, its first line item to the first lineitem element, then outwards and on to the next order

The namespaces declared under Xml Namespace Declaration apply to these paths as well as to the document being written, and IMan validates each path against them.

Initial Path

The path to the first element, or repeating set of elements, in the response.

Set it with Initial Return XPath on the writer's Field Mapping tab. The field appears only while a Sequential or Keyed rewrite is selected.

The Initial Return XPath field on the XML Writer's Field Mapping tab

Transaction Path

The path to the element, or repeating set of elements, holding this transaction's records. It is relative to the parent transaction's path, or to the Initial Path for the top-most transaction.

Set it with Transaction Type Return XPath, per transaction.

IMan matches records to the response in the order the elements appear in it: the first element to the first record, and so on.

A short response updates only the records it covers

The walk stops at whichever runs out first, the response or the data. Where the service returns fewer elements than were sent, IMan updates only the first n records, where n is the number of elements in the response. The remaining records keep the values they had, and the run does not fail.

So IMan does not report a partial response as an error. Where that matters, check downstream whether a rewritten field is empty. Do not assume every record came back.

Response Field Path

The path to the element or attribute in the response holding this field's value. Set it with Response XPath in each field's dialog.

IMan writes back only to fields with a populated Response XPath. A field left blank keeps the value it went out with.

The Response XPath field in the XML Writer's field dialog

The grid's Response XPath column shows the same value. Like the control itself, it appears only under a Sequential or Keyed rewrite on an http(s) target.

Is Relative Response XPath

Whether IMan reads the Response XPath relative to the Transaction Path, or as an absolute path from the root of the response.

It is ticked by default, which suits most cases: the path is relative to the element the Transaction Path found. Untick it to read a value from elsewhere in the response, such as a status or a batch reference that sits above the records instead of inside them.

The JSON Writer has the same control, named for JPath.