Original Message:
Sent: Wed December 17, 2025 03:49 AM
From: Basma Hesham
Subject: api connect map policy error policy=map : Output output: Invalid XML schema encountered
Hi steve,
I'm using map policy and it works well,
if I have an empty object in the json response and I want to appear it as a self closed tag in the xml response.
"propertySet":{} => wanted to be <propertySet />
I know it should be a normal behavior as I handled if it's holding values ?? so now why it's not working ??? and should I add a condition ??
------------------------------
Basma Hesham El Sayed
IBM Integration Engineer
First Abu Dhabi Bank (FabMisr)
Original Message:
Sent: Tue October 01, 2024 01:21 PM
From: Steve Linn
Subject: api connect map policy error policy=map : Output output: Invalid XML schema encountered
Hi VK,
In your map input configuration, your variable should be variable: responsemessage.body
As for your schemas, the error you are seeing is from your output schema:
outputs:
output:
schema:
type: object
variable: message.body
content: application/xml
The map policy actually does all of its mapping using JSON objects. For XML output, it then uses the output schema and the JSON output object to create the XML structure that is desired. A schema of simply "type: object" is insufficient. It must be a schema that totally describes the XML output structure. I would suggest taking an example XML output and instead of an output type of object, choose inline schema. That will allow you to create an XML schema using your example XML. Then the map policy will have the schema it needs to produce the desired XML output.
Best Regards,
Steve Linn
------------------------------
Steve Linn
Senior Consulting I/T Specialist
IBM
Original Message:
Sent: Sat September 28, 2024 09:20 PM
From: v k
Subject: api connect map policy error policy=map : Output output: Invalid XML schema encountered
Sorry for the delayed message Steve Linn,below is the code I am using
- operations:
- verb: post
path: /testjsontoxml
execute:
- parse:
version: 2.2.0
title: parse
parse-settings-reference:
parse-settings:
document_type: json
max_doc_size: 900
max_width: 440
max_nesting_depth: 300
max_name_length: 50
max_value_length: 70
input: ''
output: responsemessage
- json-to-xml:
version: 2.0.0
title: json-to-xml
root-element-name: json
always-output-root-element: false
unnamed-element-name: response
input: responsemessage
output: responsemessage
conversionType: relaxed-badgerfish
- map:
version: 2.1.0
title: map
inputs:
input:
schema:
type: object
variable: responsemessage
content: application/xml
outputs:
output:
schema:
type: object
variable: message.body
content: application/xml
actions:
- set: output
from: input
------------------------------
v k
------------------------------
------------------------------
v k
Original Message:
Sent: Fri September 20, 2024 09:06 AM
From: Steve Linn
Subject: api connect map policy error policy=map : Output output: Invalid XML schema encountered
Hi VK,
In my simple test, the json-to-xml policy took input message responseMessage and converted the JSON to XML, writing the XML to the context message responseMessage in place. That should be what you're seeing since you're expecting the map input to be getting XML input from responseMessage.body. The map policy is schema driven for both the inputs and outputs, and when you specify that an input or output is application/xml, the schema will be examined to ensure you have one and only one root element in the schema. The error message is indicating that your schema for the output named output is invalid. What does the map policy and its output schema look like?
Best Regards,
Steve Linn
------------------------------
Steve Linn
Senior Consulting I/T Specialist
IBM
Original Message:
Sent: Wed September 18, 2024 12:54 PM
From: v k
Subject: api connect map policy error policy=map : Output output: Invalid XML schema encountered
I am trying to test jsontoxmlpolicy below are the steps I configured .I just want to parse the inout and save it to an variable. Use that variable in jsontoxml policy save output in a variable.how can I achieve this?
1)parse policy with Message for resulting parsed data mapped to element responseMessage.
2)json-to-xml policy with input configured to responseMessage output is given empty .
3)map policy to map input responseMessage.body to message.body as output.
I am receiving the below error.
"moreInformation": "Map: API=testjsontosoapconversion, policy=map : Output output: Invalid XML schema encountered, multiple elements or no elements: ; cannot be specified at the root document level."
}
------------------------------
vk k
------------------------------