I have Java Web service , and a parameter to one web method is a custom Java type

public class KeyList {
public Integer key;
public Integer[] nums ;
public Integer result;
}

The Web service updates the Result value and returns the KeyList object to the client.

I have a C# client to this Web service ( generated in Visual Studio by adding Service Reference and pointing to the wsdl url ). When I receive the keyList object in C# , the first part ( Integer key ) comes out as 0. If I change the Java custom type to use int key ( rather than Integer Key ) in the KeyList type , then it works fine for the C# client.

I wanted to see if the wsdl was drastically different between the two cases ( using int and Integer ) , but it turns out that the only difference is a minOccurs attribute.

when using Integer key

<xs:element name="key" type="xs:int" minOccurs="0" /> 

when using int key

<xs:element name="key" type="xs:int" /> 

What is the cause for the C# client not correctly receiving the updated Integer in the return value from the service ? Needless to say it works fine for a Java client either way.


Edit : C# class generated by VS for KeyList :

public class keyList : INotifyPropertyChanged{

private int keyField;
private bool keyFieldSpecified;

private int?[] numsField;
private PropertyChangedEventHandler PropertyChanged;
private int resultField;
private bool resultFieldSpecified;

public event PropertyChangedEventHandler PropertyChanged;

public keyList();
protected void RaisePropertyChanged(string propertyName);

[XmlElement(Form=XmlSchemaForm.Unqualified, Order=0)]
public int key { get; set; }
[XmlElement("nums", Form=XmlSchemaForm.Unqualified, IsNullable=true, Order=1)]
public int?[] nums { get; set; }
[XmlElement(Form=XmlSchemaForm.Unqualified, Order=2)]
public int result { get; set; }
[XmlIgnore
Edit
Report