Map many-to-one relationship using Import Mapping with a Message Definition as the schema source
Hello, I have the domain model below: I’m attempting to use an import mapping to map the string below: <result> <name>Adam</name> <data> <sorecurdocument> <RECORDNO>1</RECORDNO> </sorecurdocument> <sorecurdocument> <RECORDNO>2</RECORDNO> </sorecurdocument> <sorecurdocument> <RECORDNO>3</RECORDNO> </sorecurdocument> </data> </result> The import mapping is below. Notice the Schema source is a message definition. When using an ‘Import with mapping’ activity on the above string, the resulting object contains an association to an empty list of ‘sorecurdocument’ objects. From the string, there should be three objects created. Any ideas on what’s going wrong? Right now, this issue is forcing me to use an XML schema as a Schema source within my import mapping, rather than a message definition, which isn’t ideal. Thank you!
Indeed, this doesn’t work with a message definition, you need an XML schema.
A message definition works when there is an XML element for each entity and association.
So in your case the message definition can be used to import XML that has an additional xml element, such as
In Your Domain model, you have Data as a separate entity causing it to appear in the mapping you generated from the message definition as well. Can you try if it works when you add an association from your entity ‘sorecurdocument’ to entity ‘Result’ and then generate the Export mapping from the message definition?