Passing Arrays to Web Services

Web Services cannot be passed (in or out) of an array field. Therefore, if a process needs a field that contains multiple instances of a Business Object that it wants to pass in or out of a web service, it will have to wrap it in a BOM class. The BOM class must contain a multi-instance attribute. The multi-instance attribute must contain the multiple instances rather than an Array field.

For example, if you want to pass an array of Strings to a webservice, then you cannot just have a Text parameter flagged as an Array:

Instead, create a BOM class to wrap the multiple Text values like this (Note that multiplicity of 0..* indicates that the attribute can contain zero or more values which is like the Array setting on a Process Field):

And then reference this type as a parameter:

If you define a webservice with an Array parameter, the following error message appears:

BDS Process 1.0 : Activities responsible for generating WSDL operations cannot have array parameters associated, instead please create a business object class to contain the array. (ProcessPackageProcess:StartEvent)

When calling the webservice, copy the text array into the parameter structure with a loop like this in the ServiceTask’s Init Script, as shown below:

If an array of Business Objects was being passed using the ScriptUtil.copyAll() method, as described in Looping Through Lists and Copying Elements in Lists, could be used to copy the array of Business Objects in a single statement, but that cannot be used for Basic fields like the Text array in this example.

An Array object can be passed to other Task types, for example, User Tasks or ScriptTasks. Only the WebService task does not support Array fields.