Passing Array Elements for Savon 2 (SOAP) Passing Array Elements for Savon 2 (SOAP) ruby ruby

Passing Array Elements for Savon 2 (SOAP)


You can try this syntax :

message = {  ...  "CampaignIds" => {"int" => [3,4]},  ...}

That'll produce this output :

<CampaignIds>  <int>3</int>  <int>4</int></CampaignIds>

Hope this helps.


I just experienced the same issue and found a solution, that's not dependent on having a permissive SOAP endpoint. You can configure this behavior as a global using the unwrap key. This key is given as an option to Gyoku which generates the XML for Savon.

client = Savon.client(wsdl: 'https://example.com/wsdl', unwrap: true)client.call(:cook_meal, message: { 'Ingredients' => ['tomato', 'basil', 'mozzarella'] })

Although the issue is old, better late than never.