Handle custom JSON body for HTTP API with OSB 12.2.1
In this post, we will learn how to handle custom JSON messages for HTTP services with OSB 12.2.1, there we go:
The REST API connector allows to use REST web services via HTTP but sometimes we need to struggle when the JSON data structure is not compatible with XML structure at all.
For solving this, is necessary to know what is the complete structure of the request REST service, since the structure of the content body could be a bit tricky to manage then we are going to do some steps to handle it in a good way.
Let’s start creating the HTTP transport as the image below
Then select the request message type as TEXT, so you will be able to send the message body as TEXT with any type structure.
Next step is to build the JSON request as string, we can use xquery function as the image below
As you can see, it is possible to build any JSON body since we start creating from scratch as string.
When we have the request complete as string the next step is call the rest service and set is as JSON using transport header.
Finally use the xquery mapping file in a assign component and include this as a request of the service callout
If you have any questions let me know, thanks.