cancel
Showing results for 
Search instead for 
Did you mean: 

Message Mapping Error .

Former Member
0 Kudos

Hi,


While executing Message Mapping I am getting LastName data in wrong Node on Target Side.

eg.
<root>
<Source> /* Data 1 */
<FirstName>FName1</FirstName>
<LastName>LName1</LastName>
</Source>
<Source> /* Data 2  - Here from Source I am not getting last name in XML Paylaod*/
<FirstName>Name2</FirstName>
</Source>
<Source> /* Data 3 */
<FirstName>Name3</FirstName>
<LastName>LName3</LastName>
</Source>
</root>


Where as on response side, I am getting target XML as this.

<Target>/* Data 1 */
<FirstName>FName1</FirstName>
<LastName>LName1</LastName>
</Target>
<Target>/* Data 3 */
<FirstName>FName2</FirstName>
<LastName>LName3</LastName>  -- Wronge data here ---
</Target>
<Target>/* Data 3 */
<FirstName>FName3</FirstName>
</Target>

How to handle such case

I have attached following for your reference.

1. Screenshot of MessageMapping .
2. XSD of Source side Structure.   - Sorry not able to attach
3. Sample XML Payload.


Regards
PS

Accepted Solutions (1)

Accepted Solutions (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hello Prabhat,

You can use mapWithDefault after the last name so that the contexts are aligned e.g

LastName -> mapWithDefault -> yourMappingLogic

edit:

Here is the mapping I used for Records and ID

For Staff No

For FirstName and LastName

Hope this helps,

Mark

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

abhradeepbasu
Participant
0 Kudos

Hi Prabhat,

Simply use mapwithdefault function, it should work for you. The sugggestions from experts above are nicely presented already.

/AB

Former Member
0 Kudos

Hello,

Adding to what Mark has suggested, u can add "Ifwithout Else" after "mapwithDefault" where u can check if "LastName" is not empty then only pass source value to its corresponding target field...in this way ur second target segment will not have "LastName" target field with empty value

Thanks

Amit Srivastava

Muniyappan
Active Contributor
0 Kudos

Hi,

Mark suggestion should work for you.

as mentioned by Amit if you don't want fields when it is not appearing(empty) you can use ifwithoutelse function.

Regards,

Muniyappan.