Import with self reference.

0
Hi, I'm using a webservice and using an import mapping. I create the mapping by a webservice operation and see the elements as shown below. The last sequence starting at children is repeating itself 0..* times.  The domainmodel (created by Mendix when mapping automatically): The mapping itself: FIrst association is correct:  (out – tree: 1-1) Second association is correct (tree – item: 1-*) Third  association not as expected (item – item: *-1). I was hoping then the last association would be a 1-* (instead of  *-1). How can I get this right with a self reference? When remove the self reference and manually add another Node object and create a 1-*, then it works fine. But I don't think I need to create 10 or more levels deep? That's what the self reference is for, or am I wrong here? How do you handle this? Here's an example of the HTTP-response body received from the webservices. This data is going to be mapped with the import mapping. <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SOAP-ENV:Body> <dutchBusinessGetOrganizationTreeResponse xmlns="http://www.webservices.nl/soap/"> <out> <name>Company BlaBla BV</name> <dossier_number>00000000</dossier_number> <tree> <name>Company MotherOfAllMothers</name> <type>Company</type> <id>10101010</id> <children> <item> <name>Company AlmostThereMother</name> <type>Company</type> <id>01020304</id> <children> <item> <name>Company Whihaaa</name> <type>Company</type> <id>01234567</id> <children> <item> <name>Company NeverEndingStory</name> <type>Company</type> <id>10293847</id> <children> <item> <name>Company ReallyAlmostThere</name> <type>Company</type> <id>98798798</id> <children> <item> <name>Company BlaBla BV</name> <type>Company</type> <id>00000000</id> </item> <item> <name>Company FooFoo BV</name> <type>Company</type> <id>000000001</id> </item> </children> </item> </children> </item> </children> </item> </children> </item> </children> </tree> </out> </dutchBusinessGetOrganizationTreeResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>  
asked
1 answers
0

Do not use create new object but use a microflow to retrieve the object. Pass the parent as parameter. This way you can set the self reference yourself. It would have been easier if they just supplied the parent ID also in the entity. Because then you can build the hierarchy yourself.

Regards,

Ronald

[EDIT] Do note that this only work with persistent objects and not with non-persistent.

answered