Share via


How to: Model Web Methods with Collections in Input

Suppose you have a Web method that takes a collection as one of its input parameters; for example, Customer[] GetCustomers(String[] ReturnFields). By design, the Business Data Catalog in Microsoft Office SharePoint Server 2007 takes only the first item in the collection as the value for the input parameter. It ignores the rest of the items in the collection—even if you define the input parameter Customers[] as a collection.

However, you might want to invoke the above Web method with say, Name and Address. In such a case, you should model each return field as a child TypeDescriptor of the ReturnFieldsTypeDescriptor and set IsCollection on the parent TypeDescriptor as false, as shown in the following code.

Note

You must know the exact number of return fields you might be interested in at the time of modeling.

Example

<Parameter Direction="In" Name="ReturnFields"
   <TypeDescriptor Name="ReturnFields 
       TypeName="String[] IsCollection="false" ">
      <TypeDescriptor Name="Name" TypeName="String">
      </TypeDescriptor>
      <TypeDescriptor Name="Address" TypeName="String">
      </TypeDescriptor>
   </TypeDescriptor>
</Parameter>