Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mandatory fields in WSDL2Java classes

 
Muthukrishnan Manoharan
Ranch Hand
Posts: 91
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a WSDL, with which I created Java Classes through WSDL2Java tool. But the problem is not all attributes that are returned from the response SOAP XML will have a value. Some may be null also. So when I construct back the objects from the response, it is not able to parse double object or Integer object as the nulls encounter NumberFormatException. Is there anyway I can specify to by pass null objects during Java Classes creation through the tool or do we have other good way to handle this.
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
If you have the opportunity to be able to edit the WSDL, then use minOccurs="0" for elements that are optional.
There is also a nillable attribute for elements that can be set to true to allow for null values: nillable="true"
Best wishes!
 
Muthukrishnan Manoharan
Ranch Hand
Posts: 91
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ivan.

Any other alternatives than changing the WSDL? Because we dont have an independence to change the WSDL.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic