webMethods and Intelligent Business Operations 10.2 | API Gateway User's Guide | Policies | System-defined Stages and Policies | Request Processing | Request Transformation
 
Request Transformation
This policy enables you to configure several transformations on the request messages from clients into a format required by the native API before it is submitted to the native API.
The transformations include Header, Query Parameter, Path Parameter transformation, HTTP Method transformation, Payload transformation, and Advanced transformation. You can configure conditions according to which the transformations are executed.
API Gateway supports the following parameter types that can be used to configure the transformation policy:
*request.payload
*request.headers
*request.query (applicable only for REST API)
*request.path (applicable only for REST API)
*request.httpMethod (applicable only for REST API)
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. You can add multiple conditions with logical operators.
Available values are:
*AND. API Gateway transforms the requests that comply with all the configured conditions.
*OR. This is selected by default. API Gateway transforms the requests that comply with 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 - path, payload, httpMethod. For example: ${request.path}
*${PARAMTYPE.paramName} : This is applicable for map types - query and headers and also applicable for path. For example: ${request.query.var1}, ${request.header.Content-Type}, ${request.path.name}
*${PARAMTYPE.QUERYTYPE[queryValue]} : This syntax is applicable for payload and path. regex can be applied on path while XPath, JSONPath and regex can be applied on payload. For example:
${request.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
${request.payload.jsonPath[$.cardDetails.number]} where $.cardDetails.number is the jsonPath to be applied on the payload if contentType is application/json
${request.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:
${request.payload.xpath[//ns:emp/ns:empName] || request.payload.jsonPath[$.cardDetails.number]} This applies xpath for application/xml and jsonPath for application/json
${request.payload.xpath[//ns:emp/ns:empName] || request.payload.jsonPath[$.cardDetails.number] || request.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 incoming requests.
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 - path, payload, httpMethod. For example: ${request.path}
*${PARAMTYPE.paramName}. This is applicable for map types - query and headers and also applicable for path. For example: ${request.query.var1}, ${request.header.Content-Type}, ${request.path.name}
*${PARAMTYPE.QUERYTYPE[queryValue]}. This syntax is applicable for payload and path. regex can be applied on path while XPath, JSONPath and regex can be applied on payload. For example:
${request.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
${request.payload.jsonPath[$.cardDetails.number]} where $.cardDetails.number is the jsonPath to be applied on the payload if contentType is application/xml
${request.payload.regex[[0-9]+]} where [0-9]+ is the regex to be applied on the payload if contentType is anything
*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:
${request.payload.xpath[//ns:emp/ns:empName] || request.payload.jsonPath[$.cardDetails.number]} This applies xpath for application/xml and jsonPath for application/json
${request.payload.xpath[//ns:emp/ns:empName] || request.payload.jsonPath[$.cardDetails.number] || request.payload.regex[[0-9]+]} This applies xpath for application/xml, jsonPath for application/json, and regex for text/xml.
*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
Method transformation for REST API
Specifies the method transformation to be configured for incoming requests.
Select any of the HTTP Method listed:
*GET
*POST
*PUT
*DELETE
*CUSTOM
Note: When CUSTOM is selected, the HTTP method in incoming request is sent to the native service. When other methods are selected, the selected method is used in the request sent to the native service.
Note: Only Method Transformation happens when configured, but you have to take care of adding payload during transformations involving method change like GET to POST, and so on.
Payload Transformation
Specifies the payload transformation to be configured for incoming requests.
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 request 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 incoming requests.
Provide the following information:
*webMethods IS Service. Specify the webMethods IS service to be invoked to process the request 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 invoke 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 incoming requests. For example, the namespaces configured in this section can be used when you provide the syntax for XPath ${request.payload.xpath} For example: ${request.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