JSON Nested Arrays/Objects to SOAP XML Body – I facing difficulties in converting the below JSON request to soap request in Dataweave

JSON Nested Arrays/Objects to SOAP XML Body – I facing difficulties in converting the below JSON request to soap request in Dataweave. I am attaching the input and output payloads that I am trying to convert in data weave 2.0.

Input Payload:

{
   "accountDetails":{
      "accountId":"BLM-097",
      "uniqueId":"130-135",
      "detailsList":{
         "account":[
            {
               "accountType":"On-Air",
               "accountId":"BLM-097",
               "fullName":{
                  "firstName":"John",
                  "lastName":"Doe"
               },
               "privateDetails":{
                  "SSN":{
                     "number":"123456789",
                     "vaildDate":"9/8/2005"
                  }
               },
               "contactList":{
                  "contactInformation":[
                     {
                        "emailAddress":"user123@gmail.com",
                        "phoneNumber":"123456789"
                     }
                  ]
               },
               "notificationPreferences":{
                  "notification":[
                     {
                        "notificationType":"Text",
                        "notificationMethod":"Email"
                     },
                     {
                        "notificationType":"Dial-in",
                        "notificationMethod":"Phone"
                     }
                  ]
               }
            }
         ]
      }
   }
}

Out Payload:

<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Header/>
  <soapenv:Body>
<v1:accountDetails xmlns:v1="http://placeholder/accountDetails/v1">
  <v1:accountId>BLM-097</v1:accountId>
  <v1:uniqueId>130-135</v1:uniqueId>
  <v1:detailsList>
    <v1:account>
      <v1:accountType>On-Air</v1:accountType>
      <v1:accountId>BLM-097</v1:accountId>
      <v1:fullName>
        <v1:firstName>John</v1:firstName>
        <v1:lastName>Doe</v1:lastName>
      </v1:fullName>
      <v1:privateDetails>
        <v1:SSN>
          <v1:number>123456789</v1:number>
          <v1:vaildDate>9/8/2005</v1:vaildDate>
        </v1:SSN>
      </v1:privateDetails>
      <v1:contactList>
        <v1:contactInformation>
          <v1:emailAddress>user123@gmail.com</v1:emailAddress>
          <v1:phoneNumber>123456789</v1:phoneNumber>
        </v1:contactInformation>
      </v1:contactList>
      <v1:notificationPreferences>
        <v1:notification>
          <v1:notificationType>Text</v1:notificationType>
          <v1:notificationMethod>Email</v1:notificationMethod>
        </v1:notification>
        <v1:notification>
          <v1:notificationType>Dial-in</v1:notificationType>
          <v1:notificationMethod>Phone</v1:notificationMethod>
        </v1:notification>
      </v1:notificationPreferences>
    </v1:account>
  </v1:detailsList>
</v1:accountDetails>
</soapenv:Body>
</soapenv:Envelope>

I tried using dataweave playground with no luck
JSON Nested Arrays/Objects to SOAP XML Body – I facing difficulties in converting the below JSON request to soap request in Dataweave. I am attaching the input and output payloads that I am trying to convert in data weave 2.0.

Read more here: Source link