aspose file tools*
The moose likes Web Services and the fly likes Axis generates unwanted xsi:nil elements Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Axis generates unwanted xsi:nil elements" Watch "Axis generates unwanted xsi:nil elements" New topic
Author

Axis generates unwanted xsi:nil elements

David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

We're using axis to generate Java stubs from our WSDL, but when we generate a message and send it, it includes elements without values as <blahblah xsi:nil="true" /> which causes the server side to reject the request. The other strange issue is that these nil elements are even included in the request when it is a choice, that is all of the choice elements are returned, with the extra elements having xsi:nil

I have tries specifying <xsd:element ... nillable="false"> for some of the elements in the xsd description, but so far this has not had any effect.

We're running Axis 1.3, I've tried targetting 1.0 when generating the stubs (-T 1.0 running WSDL2Java) but had no effect either.
Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2057
is the choice element, by your design, empty?

For the element with 'xsi:nil="true"' to be valid, I think you should put <xsd:element ... nillable="true">. Default is 'nillable="false"'.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

We don't specify a 'nillable' attribute in the element, but we still get the xsi:nil in the message I found a thread stating that trying -W for the WSDL2Java command line has fixed this in the past, but not for us.

I should also mention that we control the server and the incorrect management of the 'nil' attribute is caused by the Castor deserialisation, but at this stage it will not be a simple operation to upgrade Castor or replace it with something more robust. The Castor deserialisation has been there a while and has some custom code added to it, although luckily it is cleanly layered should we need to cut it lose later.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Axis generates unwanted xsi:nil elements