webMethods and Intelligent Business Operations 10.2 | API Gateway User's Guide | Policies | System-defined Stages and Policies | Response Processing | Response Transformation
 
Response Transformation
This policy specifies the properties required to transform response messages from native APIs into a format required by the client.
This policy enables you to configure several transformations on the response messages before it is sent to the client.
API Gateway supports the following parameter types that can be used to configure the transformation policy:
*response.payload
*response.headers
*response.statusCode
*response.statusMessage
API Gateway supports the following Query types that can be used to configure the transformation policy:
*xpath
*jsonPath
*regex
When you use these syntaxes to extract a value from the payload, the content-types applicable are:
*${payload.jsonPath} - application/json, application/json/badgerfish
*${payload.regex} - text/plain
*${payload.xpath} - application/xml, text/xml, text/html.
The table lists the properties that you can specify for this policy:
Parameter
Description
Condition
Conditions are used to specify when the policy has to be executed. We can add multiple conditions with logical operators.
Available values are:
*AND. API Gateway transforms the responses that comply with all the configured conditions
*OR. This is selected by default. API Gateway transforms the responses that comply at least one configured condition.
Click Add Condition and provide the following information and click .
*Variable. Specifies the variable type with a syntax as follows:
*${PARAMTYPE} : This is applicable for variables of string type - payload, statusCode and statusMessage. For example: ${response.payload}
*${PARAMTYPE.paramName} : This is applicable for map types - headers. For example: , ${response.header.Content-Type},
*${PARAMTYPE.QUERYTYPE[queryValue]} : This syntax is applicable for payload. XPath, JSONPath and regex can be applied on payload. For example:
${response.payload.xpath[//ns:emp/ns:empName]} where //ns:emp/ns:empName is the xpath to be applied on the payload if contentType is application/xml
${response.payload.jsonPath[$.cardDetails.number]} where $.cardDetails.number is the jsonPath to be applied on the payload if contentType is application/json
${response.payload.regex[[0-9]+]} where [0-9]+ is the regex to be applied on the payload if contentType is text/plain
*If you want API Gateway to apply xpath, jsonPath, regex based on Content-Type of the payload, use the following common syntax: ${PARAMTYPE.QUERYTYPE[queryValue] || PARAMTYPE.QUERYTYPE2[queryValue2] || ...}
For example:
${response.payload.xpath[//ns:emp/ns:empName] || response.payload.jsonPath[$.cardDetails.number]} This applies xpath for application/xml and jsonPath for application/json
${response.payload.xpath[//ns:emp/ns:empName] || response.payload.jsonPath[$.cardDetails.number] || response.payload.regex[[0-9]+]} This applies xpath for application/xml, jsonPath for application/json, and regex for text/plain.
*Operator. Specifies the operator to use to relate variable and the value provided. You can select one of the following:
*Equals
*Equals ignore case
*Not equals
*Contains
*Exists
*Value. Specifies a value with a syntax as follows:
*PLAIN VALUE, for example, application/json
*${PARAMTYPE.paramName}
*${PARAMTYPE.QUERYTYPE[queryValue]}
*${PARAMTYPE.QUERYTYPE[queryValue] || PARAMTYPE.QUERYTYPE2[queryValue2] || ...}
Transformation Configuration. Specifies various transformations to be configured.
Header/Query/Path Transformation for REST API
and
Header Transformation for SOAP API
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:
*Variable. Specifies the variable type with a syntax as follows:
*${PARAMTYPE} : This is applicable for variables of string type - payload, statusCode and statusMessage. For example: ${response.payload}
*${PARAMTYPE.paramName} : This is applicable for map types - headers. For example: , ${response.header.Content-Type},
*${PARAMTYPE.QUERYTYPE[queryValue]} : This syntax is applicable for payload. XPath, JSONPath and regex can be applied on payload. For example:
${response.payload.xpath[//ns:emp/ns:empName]} where //ns:emp/ns:empName is the xpath to be applied on the payload if contentType is application/xml
${response.payload.jsonPath[$.cardDetails.number]} where $.cardDetails.number is the jsonPath to be applied on the payload if contentType is application/json
${response.payload.regex[[0-9]+]} where [0-9]+ is the regex to be applied on the payload if contentType is text/plain
*If you want API Gateway to apply xpath, jsonPath, regex based on Content-Type of the payload, use the following common syntax: ${PARAMTYPE.QUERYTYPE[queryValue] || PARAMTYPE.QUERYTYPE2[queryValue2] || ...}
For example:
${response.payload.xpath[//ns:emp/ns:empName] || response.payload.jsonPath[$.cardDetails.number]} This applies xpath for application/xml and jsonPath for application/json
${response.payload.xpath[//ns:emp/ns:empName] || response.payload.jsonPath[$.cardDetails.number] || response.payload.regex[[0-9]+]} This applies xpath for application/xml, jsonPath for application/json, and regex for text/plain.
*Value. Specifies a value with a syntax as follows:
*PLAIN VALUE, for example, application/json
*${PARAMTYPE.paramName}
*${PARAMTYPE.QUERYTYPE[queryValue]}
*${PARAMTYPE.QUERYTYPE[queryValue] || PARAMTYPE.QUERYTYPE2[queryValue2] || ...}
You can add multiple variables and corresponding values by clicking .
You can remove any header, query or path transformation parameters by typing the value in the text box.
Note: In the 10.2 release, payload transformation does not happen automatically for content-type transformation. When you change the content type, ensure to do payload transformation also as part of IS Service. For example, if you change the content-type header from application/xml to application/json using IS service, you must also change the respective payload from application/xml to application/json
Status transformation
Specifies the status transformation to be configured for the responses received from the native API.
Provide the following information:
*Code. Specifies the status code that is sent in the response to the client.
*Message. Specifies the Status message that is sent in the response to the client.
Payload Transformation
Specifies the payload transformation to be configured for the responses received from the native API.
Provide the following information:
*Click + Add xslt document to add an xslt document and provide the following information:
*XSLT file. Specifies the XSLT file used to transform the response messages as required.
Click Browse to browse and select a file.
*Feature Name. Specifies the name of the XSLT feature.
*Feature value. Specifies the value of the XSLT feature.
You can add more XSLT features and xslt documents by clicking .
*Click + Add xslt transformation alias and provide the following information:
*XSLT Transformation alias. Specifies the XSLT transformation alias
Advanced Transformation
Specifies the advanced transformation to be configured for the responses received from the native API..
Provide the following information:
*webMethods IS Service. Specify the webMethods IS service to be invoked to process the response messages.
You can add multiple services by clicking .
Note: The webMethods IS service must be running on the same Integration Server as API Gateway.
*Run as User. Specifies the authentication mode to invoke the IS service. If this field is left blank the incoming credentials of the user, identified by API Gateway, are used to authenticate and invoke the IS service. You can also specify a particular user, you want API Gateway to use to run the IS service.
*Comply to IS Spec. Specifies whether you want the input parameters and the output parameters to comply to those present in pub.apigateway.invokeISService.specifications.
*webMethods IS Service alias. Specifies the webMethods IS service alias to be invoked to pre-process the request messages.
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:
*Namespace Prefix. The namespace prefix of the payload expression to be validated.
*Namespace URI. The namespace URI of the payload expression to be validated.
Note: You can add multiple namespace prefix and URI by clicking .

Copyright © 2015- 2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Innovation Release