In this example, we will show how to use the CDATA function in the Adeptia mapper to insert XML payload into a Create Policy Quote SOAP Service. Suppose the SOAP WSDL requires complete XML payloads in three of its fields, “Spec” that contains Policy Details, “Stream” which contains Policy Header and “Action” that contains Policy function such as updated quote, new quote etc.
The three target fields would contain the Insured’s policy and the action we need to perform as part of the Create Quote Insurance service. Policy Header contains the Insured’s contact, policy number and policy data. Policy Detail contains the coverages selected for the Policy, Dependent data, Lines of Business, and the Policy Effective dates. The Policy Action requires the action we need to execute when calling this service, such as getting a Quote back from the service call as a response.
First step is to create target XML schemas for Policy Header, Policy Detail and Policy Action. This will help us to map the source JSON data to these three XML outputs. Source data is a RESTful JSON API request sent by an Insurance Comparative Rating System.
In the below map, the 3 XMLs were added as target schemas and the JSON is mapped to the related XML outputs for Policy Header, Policy Detail and Policy Action. This map produces three XML outputs that are then passed to the Create Quote SOAP as the final step in the flow.
Output of the 3 XML are inserted into three separate context variables that are then mapped to the Create Quote SOAP XML as CDATA. Mapper’s CDATA function inserts any payload as CDATA into the related target fields. Three context variables named are
Below is the CDATA function available in the Adeptia mapper that allows insertion of complete data payload into a target field.
For more information on how to use CDATA function, go here.
Now let’s look at the orchestration of how the incoming JSON REST request is passed to the SOAP WSDL.
This orchestration is published as a synchronous RESTful API and acts as a wrapper web service which takes the JSON from the client, maps JSON to the SOAP service, gets the response back from the SOAP service, wraps the XML response back to JSON and sends JSON response back to the client. Here we are highlighting the part of how the JSON is mapped to three separate XML outputs which are stored in three context variables and then we are passing the context variables into the final SOAP mapping.