Forum Discussion

yashasvi74's avatar
yashasvi74
New Contributor
4 years ago
Solved

Posting xml to webservice through rest post snap

Hi ALL, There’s a requirement where need to post a xml to a webservice using REST POST snap but its not working instead giving error (cannot use SOAP execute snap). But when trying to post the sa...
  • JensDeveloper's avatar
    4 years ago

    Hi @aditya.gupta41

    you should use the function mapKeys in a mapper snap to get the key value and rename it.

    Inside the mapper snap you should use this expression:
    $[‘soapenv:Envelope’][‘soapenv:Body’][‘ns1:MT_SWE_FI_PEGA_ABAON’].mapKeys((value, key) => key == “CLIENT” ? “CLIENTID” : key)

    This expression will first check every key if it equals the value “CLIENT” and if true it will rename it to whatever you want to rename it to. If false the key name is not changed

    And give as target path the path of the original one until the object that contains CLIENT
    $[‘soapenv:Envelope’][‘soapenv:Body’][‘ns1:MT_SWE_FI_PEGA_ABAON’]

    The result:

    Regards

    Jens