Response Transformation
This policy specifies the properties required to transform response messages from native APIs into a format required by the client.
The transformations include Header transformation, Status transformation, Payload transformation, and Advanced transformation. You can configure conditions according to which the transformations are executed.
Property | Description |
---|---|
Condition | Conditions are used to specify when the policy has to be executed. You can add
multiple conditions with logical operators. Available values are:
Click Add Condition and provide the following information and click
![]()
For details about the variables available in webMethods API Gateway, see Variables Available in API Gateway. |
Transformation Configuration | Specifies various transformations to be configured. |
Header Transformation | Specifies the header, query or path transformation to be configured for the
responses received from the native API. You can add or modify header, query or path transformation parameters by providing the following information:
You can add multiple variables and corresponding values by clicking You can remove any header, query, or path transformation parameters by typing the plain value or value with a syntax. Note: Do not modify the Content-Length, Content-Encoding, and Set-Cookie headers as webMethods API Gateway
replaces the values for these headers irrespective of values modified at policy level.
For details about the variables available in webMethods API Gateway, see Variables Available in API Gateway. Note: Payload transformation does not happen automatically for content-type transformation. When you
change the content type, ensure to do payload transformation. For example, if you change the
content-type header from application/xml to application/json, you must also change the respective
payload from application/xml to application/json.
You can retrieve response cookie headers
using flow services. Add the WmAPIGateway.zip package as a dependent package to your test package.
This makes all the necessary jars available, and you can import the message context from
org.apache.synapse.MessageContext. You can use the following code snippet as a sample:
|
Status transformation | Specifies the status transformation to be configured for the responses
received from the native API. Provide the following information:
|
Payload Transformation | Specifies the payload transformation to be configured for the responses
received from the native API. Note: webMethods API Gateway does
not process the payload, if the payload is sent as a stream.
Provide the following information:
|
Advanced Transformation | Specifies the advanced transformation to be configured for the responses
received from the native API. Provide the following information:
|
Transformation Metadata | Specifies the metadata for transformation of the responses received from the native API. For example, the namespaces configured in this section can be used when you provide the syntax for XPath ${response.payload.xpath} For example: ${response.payload.xpath[//ns:emp/ns:empName]} |
Namespace | Specifies the namespace information to be configured for transformation.
Provide the following information:
|