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 am running the disco.exe tool to create .wsdl and .disco files from this web service for use in SharePoint. The following WSDL is created for the parameters:
<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 int parameter have minOccurs for 1 instead of 0 and how to change it ?
I tried the following without success:
[XmlElementAttribute(IsNullable=false)] in parameter declaration: doesn't matter (as expected when you think about it)
[XmlElementAttribute(IsNullable=true)] in the parameter declaration: gives the error "IsNullable could not be" true "for the value type System.Int32. Please consider using Nullable."
changing the parameter type to int ?: saves minOccurs="1" and adds nillable="true"
[XmlIgnore] in parameter declaration: parameter is never displayed on WSDL at all
source share