Passing Array data into SOAP envelope

Can anyone suggest how I can pass an array of numbers into a SOAP envelope? I need to make a SOAP API call with a list of phone numbers, as in the below example: Picture 1

Using the Customize Envelope editor of SOAP Execute snap I have successfully configured the XML for a single number as:

However the idea is to make one SOAP call with many numbers rather than making many calls for one number at a time. I don’t know how I can pass a list of numbers so that it populates the ‘<Number>’ element multiple times. Never done anything extensive with XML so not sure if I need to do something with XML Formatter/XML Generator snaps then merge the content into the Customize Envelope definition? Or create the list as a string then pass it in?

Any advice would be greatly appreciated.

Hi @chris.king,

Try by using Apache Velocity.

Syntax look like this to iterate through array.

    #foreach( $num in $Numbers )

Also here is the link to the user guide of the apache velocity.


Thanks Viktor, that worked perfectly and so much simpler than any of my ideas! I hadn’t really paid attention to Apache Velocity before but now I see how valuable it can be.
Thanks for your help :+1: