• Post Reply Bookmark Topic Watch Topic
  • New Topic

Attribute missing while marshaling  RSS feed

 
rupesh bodake
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Spring's WebServiceTemplate for consuming a webservice. But while marshaling I am facing a weird issue. Below is the XML schema.



Now when i populate the Java object with all details and when it gets marshalled, everything is populated correctly except for element "ID" in "SubscriberList".



If I change the element name from "ID" to "id" or something else, it works fine. I am not able to understand what's the issue with attribute name "ID"?
Another thing, this issue only occurs on Linux and not on my local machine.
 
Anandh Kumar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I faced the same issue and resolved it by adding getter setter with proper title case.

I believe reflection is used to access the getters and setters during the marshalling.

if you don't want to change your attribute name, try adding setId(..) instead of auto generated setID(...) and its equivalent getter.
We faced similar problem and resolved as mentioned above.
 
rupesh bodake
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anandh Kumar wrote:Hi,

I faced the same issue and resolved it by adding getter setter with proper title case.

I believe reflection is used to access the getters and setters during the marshalling.

if you don't want to change your attribute name, try adding setId(..) instead of auto generated setID(...) and its equivalent getter.
We faced similar problem and resolved as mentioned above.


But how to add the setId() and getId(). As the code is re-generated everytime using WSDL.
 
Anandh Kumar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Just curious to know why the binding classes are re-generated every time, when the contract is fixed ?

We would generate the binding classes only when and then the the WSDL contract changes. We use maven build to bind the application and the maven task for generating the JAXB classes will be isolated (commented) during regular bundling of application

Yes it is a manual change. I could not find a better way to overcome it in any reference.
 
rupesh bodake
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anandh Kumar wrote:Hi,

Just curious to know why the binding classes are re-generated every time, when the contract is fixed ?

We would generate the binding classes only when and then the the WSDL contract changes. We use maven build to bind the application and the maven task for generating the JAXB classes will be isolated (commented) during regular bundling of application

Yes it is a manual change. I could not find a better way to overcome it in any reference.


Thanks Ananadh, it worked. I've stopped regenerating the binding classes. You saved my day.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!