Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Value types not nillable in .NET

Hi,

I have written some web services in Java that use Java's java.lang.Integer
type as parameters. Since java.lang.Integer is a reference type, it can be
set to null. Therefore the generated WSDL specifies nillable="true" for these
parameters.

However, when I import the service into VS.NET using the web reference tool,
any generated code uses the .NET System.Int32 value type. Since value types
cannot be set to null this poses a problem.

When I alter the generated code to use System.Object and box / unbox the
Int32 values everything works fine, nulls included. However, it is obviously
undesirable to have to edit the generated code.

Is there a good way around this that doesn't involve altering the Java code?
Are MS working on a solution to this problem?

Thanks,
Kent
[865 byte] By [Kent] at [2007-11-9 19:48:16]