Hi Peter,

In order to make the collection itself nillable you'd need to add a 
wrapper element for the collection (such as by using 
name="CategoryLists" on the <collection> element). That would give you a 
way of saying the collection is not present in the XML representation. 
As it is now, you really should get an error for the nillable="true" 
attribute on the <collection> (since there's no element matching the 
collection itself, and nillable="true" can only be used in conjunction 
with an element).

If the XML is being generated outside your control, the best I can 
suggest is that you add a set-method for the collection and inside this 
set-method check for the case where the only thing present is a null. If 
that's the case, rather than storing the passed-in collection you'd just 
set the value null.

  - Dennis

Dennis M. Sosnoski
SOA, Web Services, and XML
Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-296-6194 - Wellington, NZ +64-4-298-6117



Peter Kennedy wrote:
> I have a problem where I am expecting a Document to unmarshall with a null
> ArrayList but I am getting an ArrayList with one Element in instead. Any
> help would be greatly appreciated.
>
> The Document that is being unmarshalled has the CategoryList coming in as
> nil="true" but the resulting java
> FindApplicationExceptionCategoryCallParameter structure ends up with an
> ArrayList with one XmlValidationCategoryElement with null values in. - I
> would expect a null ArrayList.
>
> I have tried moving the nillable="true" onto the structure within the
> collection but I can't do that as the binding compiler complains about it
> (Error: No object for structure; nillable attribute forbidden; on
> structure element at (line 35, col 81, in
> FindApplicationExceptionCategoryParameter.xml))
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <SOAP-ENV:Envelope
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>     xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
>     xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
> <SOAP-ENV:Body>
> <ns0:FindApplicationExceptionCategoryCallParameter
> xmlns:ns0="http://ws.pancredit.com/wsdl";>
> <ns0:SecurityToken>ypmjj1SkHSgZVvYuaC4SpF94IvsK9SlI0Ml8IZPGB8w4jj3hmq</ns0:SecurityToken>
> <ns0:ApplicationExceptionDescription xsi:nil="true" />
> <ns0:CategoryList xsi:nil="true" />
> </ns0:FindApplicationExceptionCategoryCallParameter>
> </SOAP-ENV:Body></SOAP-ENV:Envelope>
>
> I have the following binding
>
> <binding>
>  <include path="./classes/ValidationCategory.xml" />
>  <include path="./classes/ApplicationExceptionCategory.xml" />
>  <mapping name="FindApplicationExceptionCategoryCallParameter"
>   
> class="com.pancredit.gateway.base.param.classes.FindApplicationExceptionCategoryCallParameter"
>   ordered="false">
>   <namespace uri="http://ws.pancredit.com/wsdl"; prefix="tns"
> default="elements" />
>   <value name="SecurityToken" field="securityToken" usage="optional" />
>   <value name="ApplicationExceptionDescription"
> field="applicationExceptionDescription" nillable="true" />
>   <collection field="categoryList" usage="optional" nillable="true">
>    <structure map-as="ValidationCategory" name="CategoryList"/>
>   </collection>
>  </mapping>
>  <mapping name="FindApplicationExceptionCategoryResponseParameter"
>   
> class="com.pancredit.gateway.base.param.classes.FindApplicationExceptionCategoryResponseParameter">
>   <namespace uri="http://ws.pancredit.com/wsdl"; prefix="tns"
> default="elements" />
>   <collection field="applicationExceptionCategoryList">
>    <structure map-as="ApplicationExceptionCategory"
> name="ApplicationExceptionCategoryList" usage="optional"/>
>   </collection>
>  </mapping>
> </binding>
>
>
> This is the definition for ValidationCategory include
> <binding>
>  <mapping type-name="ValidationCategory"
> class="com.pancredit.gateway.base.classes.XmlValidationCategory"
> abstract="true" ordered="false">
>   <namespace uri="http://ws.pancredit.com/wsdl"; prefix="tns"
> default="elements"/>
>   <value name="Code" field="code" usage="optional" nillable="true"/>
>   <value name="Description" field="description" usage="optional"
> nillable="true"/>
>   <value name="ID" field="ID" usage="optional" nillable="true"/>
>  </mapping>
> </binding>
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> jibx-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>   

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to