A Nillable Element Is Not Correctly Marshaled When Returned From A Spring Context (Doc ID 1448789.1)

Last updated on OCTOBER 18, 2016

Applies to:

Oracle SOA Platform - Version: 11.1.1.4.0 to 11.1.1.5.0 - Release: 11gR1 to 11gR1
Information in this document applies to any platform.

Symptoms

You obtain something like this:

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
              xmlns:wsa="http://www.w3.org/2005/08/addressing">
<env:Body>
  
   <testNillableNumberResponse xmlns="http://testnilelement/">
      <return xmlns="" xmlns:ns0="http://xml.someDomain.com/rsg/mpl"/
   </testNillableNumberResponse>

</env:Body>
</env:Envelope>
which is invalid because a number element is missing within the return element. You would have expected the following response:

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
                         xmlns:wsa="http://www.w3.org/2005/08/addressing">
<env:Body>

   <testNillableNumberResponse xmlns="http://testnilelement/">
       <return xmlns="" xmlns:ns0="http://xml.someDomain.com/rsg/mpl">
            <ns0:number xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
       </return>
   </testNillableNumberResponse>

</env:Body>
</env:Envelope>

A workaround is to use an element with an optional child element, but this increases the verbosity of the xml.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms