We have a service endpoint that treats an empty list differently than a
null list (ie. If the parameter is null, ignore it. If it is not null,
do some work where an empty list is valid input)
We have a request object similar to:
@XmlRootElement(name = "ModifyFooRequest")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = " ModifyFooRequest ", propOrder = {"m_values"})
public class ModifyFooRequest
{
@XmlElementWrapper(name = "Values", nillable = true)
@XmlElement(name = "Value", type = Value.class)
private List< Value > m_values;
// getters/setters
}
If I send the xml below:
<soap-env:Envelope
xmlns:soap-env="
http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="
http://www.w3.org/2001/XMLSchema"
xmlns:tns="
http://mynamespace"
targetNamespace="http:// mynamespace ">
<soap-env:Body>
<tns:ModifyFooRequest><Values/></tns:ModifyFooRequest>
</soap-env:Body>
</soap-env:Envelope>
The server side gets the request object with values = null. I would
expect that values would be an empty list in this case because of the
nillable=true attribute on the xml element wrapper annotation.
Am I doing something wrong here? Is there a different way to get an
empty list across the wire instead of a null list?
Any help would be appreciated.
Thanks
Duane Homick