08-24-2021 04:12 PM
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:
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.
08-25-2021 12:06 AM
Hi @chris.king,
Try by using Apache Velocity.
Syntax look like this to iterate through array.
<NumbersToWash>
#foreach( $num in $Numbers )
<Number>$num</Number>
#end
</NumbersToWash>
Also here is the link to the user guide of the apache velocity.
Regards,
Viktor
08-25-2021 04:01 PM
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: