API Payload transformation (XML to JSON)

What product/components do you use and which version/fix level are you on?

API Gateway

Is your question related to the free trial, or to a production (customer) instance?


What are you trying to achieve? Please describe it in detail.

Trying to convert an incomming SOAP/xml request to a JSON POST request to the backend API. Backend is an IS Flow. Problem is de payload conversion in API GW Policy. I try to use an XSLT file for this (see below) but this gives a failure. When I test the XSLT in a seperate testing tool it gives me the correct result. When using in API GW Policy I get the error ‘com.fasterxml.aalto.WFCException: Unexpected character ‘{’ (code 123) in prolog’. It looks to me as if the payload transformation only support XML as output?

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/">
"order_id": "<xsl:value-of select="normalize-space(/*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='SendTaak']/Send/Taak/Taaknummer)"/>"

Do you get any error messages? Please provide a full error message screenshot and log file.

2022-11-21 11:07:28 GMT [YAI.0103.0011E] (tid=690) [default][apigw-deploy-8579478986-j2d46][APIGW:71999692-c4e8-4cb0-8280-c6ed9962cb12:690:20b0bcb30ffe46d5a537de274a9d51bf:0cf362ef~8c8749e9~first][POL:requestTransformation]I--->  Error compiling the XSLT with key {1}. org.apache.axiom.om.OMException: com.fasterxml.aalto.WFCException: Unexpected character '{' (code 123) in prolog
2022-11-21 11:07:28 GMT [YAI.0002.0071E] (tid=690) [default][apigw-deploy-8579478986-j2d46][APIGW:71999692-c4e8-4cb0-8280-c6ed9962cb12:690:20b0bcb30ffe46d5a537de274a9d51bf:0cf362ef~8c8749e9~first][POL:requestTransformation]I--->  Exception occured while executing transformation policy. Exception:

Have you installed all the latest fixes for the products and systems you are using?

Yes. Working with cloudproducts only.