Question

I have a WSDl element something like :

<xs:element maxOccurs="unbounded" minOccurs="0" name="listElement" nillable="true" type="tns:test"></xs:element>

in the SOAP request if i send empty element for listElement like :

<listElement/>

Then JaxB is creating something like :

listElement= new Arraylist<Test>();
listElement.add(new Test());

So i am getting listElement as a single arrayed with Test Object.

I want to do something which can set the listElement to Null when empty element is passed. I can 't use @XMLJavaAdapter annotation's because this is contract first and all the input objects are generated one.

I need to add some kind of binding at WSDL level or to Generation level.

Any Help will be highly APPRECIATED?

Was it helpful?

Solution

If the listElement element really represents null then it should be sent as follows:

<listElement xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>

Doing any sort of special handling is ultimately going to cause you trouble.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top