2024 Aug 14 10:22 PM - edited 2024 Aug 14 10:24 PM
Hello Experts,
I have the following incoming part of a payload from provider:
...
<acceptedDeclarationOfConsentVersion/>
<dealers>0c0c4930-a014-11e5-94f6-d8913b26e8a6</dealers>
<dealers>d1f822e0-92a4-11e5-9da5-b6f686ff8cf4</dealers>
<preferredCountry>CN</preferredCountry>
..
In the message mapping I have the following:
The problem is, that instead of writing the dealers in the result mapping as following:
<to_dealernr>
<dealerNumber>0c0c4930-a014-11e5-94f6-d8913b26e8a6</dealerNumber>
</to_dealernr>
<to_dealernr>
<dealerNumber>d1f822e0-92a4-11e5-9da5-b6f686ff8cf4</dealerNumber>
</to_dealernr>
They are instead written like this, both under 1 node and the second node empty ..:
<to_dealernr>
<dealerNumber>0c0c4930-a014-11e5-94f6-d8913b26e8a6</dealerNumber>
<dealerNumber>d1f822e0-92a4-11e5-9da5-b6f686ff8cf4</dealerNumber>
</to_dealernr>
<to_dealernr></to_dealernr>
And this is causing issues on API side as the XML is not correctly generated and the API cannot interpret the dealerNumber property when it's not in the correct format.
My question is, what can I do within the mapping in order to achieve the desired mapping which is:
<to_dealernr>
<dealerNumber>0c0c4930-a014-11e5-94f6-d8913b26e8a6</dealerNumber>
</to_dealernr>
<to_dealernr>
<dealerNumber>d1f822e0-92a4-11e5-9da5-b6f686ff8cf4</dealerNumber>
</to_dealernr>
Thanks in advance.
You can use this XSLT as the initial step to get the desired XML structure and then accommodate in your IA mapping. The only thing it does is expand the structure and copy everything else as is.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:mode on-no-match="shallow-copy"/>
<xsl:template match="dealers">
<to_dealernr>
<dealerNumber><xsl:value-of select="."/></dealerNumber>
</to_dealernr>
</xsl:template>
</xsl:stylesheet>
Regards,
Ryan Crosby
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have tried that now, but it seems the behaviour is the following:
1) I made dealerNumber 0 to 1 and mapped dealers -> dealerNumber only but like this it does not map the dealers at all.
2) I mapped dealers to to_dealernr and also to dealerNumber but in this case I have the same behaviour as before .. just that only 1 dealer number is present in the dealerNumber field ..
Could I achieve the proper result with a groovy script ?
Thanks in advance.
Hello Ryan,
First of all thanks for your support.
So you are saying I can use the XSLT script before the IA mapping to get the desired xml and then do the mapping.
That means I should create the XSLT mapping before my message mapping correct ?
I just want to make sure I understood what you are referring to.
Thanks again!
User | Count |
---|---|
69 | |
13 | |
10 | |
9 | |
9 | |
8 | |
6 | |
6 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.