Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6333843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:32:35+00:00 2026-05-24T18:32:35+00:00

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

  • 0

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]
public bool resultSpecified { get; set; }

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T18:32:36+00:00Added an answer on May 24, 2026 at 6:32 pm

    Integer in java can be null that is why you see minOccurs="0". int can not be null and this is why minOccurs is missing. In C# int (or Int32 which is the same) can not be null so it does not expect minOccurs="0". The problem is most likely in Visual Studio proxy generator.

    It should have generated nullable int in C# (Int32? or int? or Nullable<Int32>) for this element:

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

    Depending on how you generated this proxy, Visual Studio might have added additional bool field called ‘keySpecified’. It sometimes adds “Specified” suffix to the name of nullable field. It expects you to write code like this:

    if(res.keySpecified){
        // use res.Key
    } else {
        // assume res.Key is null
    }
    

    If ‘keySpecified’ has not been generated you can look at generating proxy with svcutil. It has a lot more options than what is exposed in Visual Studio. Another possible solution for you is to just stick with int on java side because it maps directly to int on C# side.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this web service in Java: @WebService(serviceName = Catalogo_V1) public class Catalogo_V1 {
I have a Java web service and want to document the public API so
I'm developing an axis java web service with two methods, both have an custom
I have one module written on Java - web service module which accepts request
We have a java web service application that uses log4j to do logging. An
I have a Java web service and a Java web client making use of
I have a JAX-RPC (Java) web service that needs to return a complex polymorphic
I have a Java client that calls a web service at the moment using
We have a dotnet web service that a java using customer wants to connect
I have created a simple web-service using Java. i want to load jars related

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.