File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes Mandatory fields in WSDL2Java classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Mandatory fields in WSDL2Java classes" Watch "Mandatory fields in WSDL2Java classes" New topic

Mandatory fields in WSDL2Java classes

Muthukrishnan Manoharan
Ranch Hand

Joined: Aug 27, 2008
Posts: 91

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

Joined: Oct 04, 2006
Posts: 2198
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!

My free books and tutorials:
Muthukrishnan Manoharan
Ranch Hand

Joined: Aug 27, 2008
Posts: 91

Thanks Ivan.

Any other alternatives than changing the WSDL? Because we dont have an independence to change the WSDL.
subject: Mandatory fields in WSDL2Java classes
Similar Threads
Adding attachments to web service response
How to get SOAP request XML for a web service call
Webservice Mapping
File Attachment with WSDL2Java objects
timezone information from zipcode