Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Axis generates unwanted xsi:nil elements

 
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.
 
Ranch Hand
Posts: 2107
  • 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.
 
Oh. Hi guys! Look at this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic