1 Reply Latest reply on Jan 22, 2006 4:49 PM by Thomas Diesler

    Serialization of null arrays



      I'm experiencing some strange behaviour with null arrays in my web service. I'm using JBoss 4.0.3.

      When I create an array with one null item in it, it gets serialized to a SOAP message as the following:

      <widgets xsi:nil="1"/>

      But also whenever I set the array to null, it gets serialized as the following:

      <widgets xsi:nil="1"/>

      However, if I create an empty array it doesn't get serialized at all.

      This seems a little strange to to me. Why would a null array be given the same meaning as an array with one null value in it? The behaviour for the empty array seems to be what I'd expect for a null array -- the array isn't serialized at all.

      The problem I have is that my Axis client interprets <widgets xsi:nil="1"/> as an array with one null value in it (though this could possibly be a mis-interpretation on its part), which is pretty nasty for people coding against my client library to have to deal with.

      Is there anything I can do about this? I'm aware that there's a lot of ambiguity surrounding arrays in SOAP, but this behaviour does seem a little odd to me.

        • 1. Re: Serialization of null arrays
          Thomas Diesler Master

          This should be fixed

          tdiesler@satellite /cygdrive/d/projects/jboss-branch/jboss-4.0.x/testsuite
          $ ant -Dtest=org.jboss.test.webservice.jbws632.JBWS632TestCase one-test
           [junit] Running org.jboss.test.webservice.jbws632.JBWS632TestCase
           [junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 5.188 sec