The Rest-2-Soap feature on Apinizer can be used to expose an XML/SOAP web service as JSON/REST. For detailed information, you can review the SOAP/REST API Proxy Creation page.
Groovy Script
By entering the name of the parent node you want to filter in the relevant XML in the"nodeName" field, you can dynamically convert that node and all its child nodes to JSON.
Explanation
This script performs the following operations:- XML Parse: XML data coming from request body is parsed
- Node Filtering: Parent node and all child nodes matching the specified
nodeNameare found - JSON Conversion: Found nodes are converted to JSON format
- Error Management: Error message is created in case of error
This script should be run on the request line (Request Policy) because it uses the
requestBodyTextFromClient and requestErrorMessageToTargetAPI variables.
