cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Passing Array data into SOAP envelope

chris_king
New Contributor II

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:
Screen Shot 2021-08-25 at 9.01.42 am

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.

2 REPLIES 2

viktor_n
Contributor II

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

chris_king
New Contributor II

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: