Rewrite (HTTP) Write Response

When a webservice creates or updates data it typically replies with the updated record. The response can be in either Binary or Textual (JSON or Xml) formats.

Binary

If a webservice responds with a binary format such as an image or PDF the response can be written back onto the IMan dataset. This handling is useful when dealing with Shipping APIs where a POST request generates a shipping request and the response is the shipping label itself.

In order to write the binary response back onto the IMan dataset there are three conditions:

  • There must be a field named 'SYS.RESPONSE'
  • The field type must be Binary.
  • The field must be declared at the top most Transaction Type.

TEXTUAL (JSON & Xml)

If a webservice responds in either JSON or Xml formats, the values of the response can be written back to fields on the IMan dataset.

If the response is JSON the path syntax is JPath whereas the path syntax is XPath for Xml formats.

The response works in the same fashion as the JSON & Xml readers. The exception is that all paths are relative (non-relative property/node access are not supported).

The response is traversed using the Initial Return Path, Transaction Path(s) and Field Paths.

Initial Path

The initial specifies the path (JPath or XPath) to the first array or repeating set of nodes.

Transaction Path

The Transaction Path specifies the path to the property/node to an array or repeating set of nodes. The path is relative to relative to the parent Transaction Type or the Initial JPath if it's the top most Transaction Type.

Transactions are updated in order they appear in the response. I.e. IMan expects the response to order the elements in the order as the request.

If the service responds with less transactions than the original request only the first X transactions in IMan will be updated, where X is the number of elements in the response.

Response Field Path

The field path specifies the path to the property/node in the response relative to the Transaction Path.

Only those fields which have a populated Return Path will have a value written back.