1

This is related to my other question about CXF proxies not accepting nulls.

From this auto-generated WSDL:

<xs:complexType name="someMethod2">
    <xs:sequence>
        <xs:element maxOccurs="unbounded" minOccurs="0" nillable="true" name="params2" type="xs:string"/>
    </xs:sequence>
</xs:complexType>

A proxy like this is generated:

public class SomeMethod2
{
    protected String[] params2; 
    ...
    public String[] getParams2()
    {
        // CXF replaces null with an empty array
        if (this.params2== null)
        {
            return new String[0];
        }
        String[] retVal = new String[this.params2.length];
        System.arraycopy(this.params2, 0, retVal, 0, this.params2.length);
        return (retVal);
    }
    ...
}

As you can see, in "getOtherParams" the null gets switched for an empty String array. This causes issues in legacy code which has dependent on receiving a hard-null. Why does CXF doe this and is there any way to configure CXF/JAXB/JAXWS to force the return of an actual null?

Community
  • 1
  • 1
roadSurfer
  • 557
  • 1
  • 5
  • 17

0 Answers0