Setting minOccurs="0" (required) on web service parameters of type int
- by Alex Angas
I have an ASP.NET 2.0 web method with the following signature:
[WebMethod]
public QueryResult[] GetListData(
string url, string list, string query, int noOfItems, string titleField)
I'm running the disco.exe tool to generate .wsdl and .disco files from this web service for use in SharePoint. The following WSDL for the parameters is being generated:
<s:element minOccurs="0" maxOccurs="1" name="url" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="list" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="query" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="noOfItems" type="s:int" />
<s:element minOccurs="0" maxOccurs="1" name="titleField" type="s:string" />
Why does the int parameter have minOccurs set to 1 instead of 0 and how do I change it? I've tried using [XmlElementAttribute(IsNullable=false)] in the parameter declaration without success.