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

Axis generates unwanted xsi:nil elements

 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2068
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic