I use wsdl.exe to convert the WSDL file and the Types.xsd file to a C # file. The wsdl file indicates optional variables ( minOccurs="0" maxOccurs="1" ), and the generated .NET type handles this by creating two fields: one for the variable (for example, status ) and one to let you know if it is specified ( statusSpecified )
Is there a way to use the wsdl tool only to create a single field that is Nullable (i.e. if not null, it is specified)? (If this helps, I think I can modify the wsdl file to have nillable="true" elements.)
Is there any other, better tool that will generate .NET types from WSDL? I am using .NET 4, so it would be useful if the generated types used functions of type Nullable.
NOTE. I just realized that I am using the wsdl tool from .NET 2, and that newer projects should use WCF for this. Any pointers to the way WCF get what I want?
As for WCF, in this article I pointed to the use of the svcutil tool (which was already in my PATH, so I could just run it from the command line in the folder with the wsdl and xsd files as follows: svcutil *.wsdl *.xsd /language:C# ). Unfortunately, svcutil does not seem to do anything better using Nullable types instead of xSpecified variables.
Pat
source share