Posting and Reading XML data via DCKAP Integrator
Send and receive XML data via DCKAP Integrator
In order to be able to send and receive XML data via DCKAP Integrator, the steps below must be followed in both the POST and GET requests.
- Open the DCKAP Integrator API Manager.
- DCKAP Integrator will allow data manipulation only in JSON format. So create the request in JSON format (expected: XML format).
- If the API header contains 'Content-Type' as 'application/xml or text/xml'.
- DCKAP Integrator will convert the input JSON format into XML format internally and send it to the respective APIs.
DCKAP Integrator API Manager screen
- Next, go to the DCKAP Integrator Flows which consists of this particular API request.
- In the Flow edit page, add the necessary handlers to consider the XML request as required by the business logic.
- A few examples are explained below:1.Example 1 Adding namespace:
- If namespace needs to be added in the request payload, add it in JSON format itself.
- If the namespace is not added then DCKAP Integrator will assign a default namespace.
- If namespace is not needed, assign the request payload to the 'plain_request' tag.
- Note: Some systems will not use namespaces. For those systems, assign the JSON request payload to 'plain_request' tag before sending it to API.
Example:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://schema.b2boptic.com/b2boptic_lensorder_v1.6.3.xsd">
<soapenv:Header/>
<soapenv:Body>
<sch:GetHeaderDetailsRequest>
<customersOrderId>13</customersOrderId>
</sch:GetHeaderDetailsRequest>
</soapenv:Body>
</soapenv:Envelope>
2. Example 2 Using the Formatter Handler:
- The formatter handler is used to stringify/dump the JSON.
Adding namespace and using the Formatter handler
Available Options
- JSON Dumps - the output might include white-spaces.
- JSON Dumps with separators - Eliminate white-space. To get the most compact JSON representation.

3. Example 3 GET API Call and Formatter :
- To convert XML response to JSON
- In order to be able to read an XML input, use the Formatter Handler and select 'Convert XML to JSON' from the dropdown list.
- Assign the input to a variable in the Handler
Using the Formatter handler to convert XML to JSON
Last modified 1yr ago