In part this SnapLogic tips and tricks series we have demonstrated how the XML Generator Snap:
- Allows you to generate the XML based off an XSD
- Allows you to map to the JSON schema upstream
- Validates the generated XML against the XSD
In this final part of the series, we will cover how the XML Generator Snap creates one serialized XML string for every input document.
Example 4: POSTing the Generated Content
In the last example we will be POSTing the generated content to some REST endpoint using the REST POST Snap.
In the screenshot below we are using the POST Snap which has the entity set as $xml. That will use the XML content that was generated by the upstream XML Generator Snap and POST it as a body to the endpoint.
You might want to set the content-type and accept header as defined below.
The POST will be executed for every document on the input view. There are a total of two documents, hence we will execute two post requests.
In summary, XML Generator Snap enables you to generate XML data, either directly in the Snap using the XML template or dynamically by using data from the input view. It lets you generate the XML by providing an XSD and it can validate the created XML against the XML at runtime.