Hi Madock, You might find the Jibx2Wsdl example2 (examples/jibx2wsdl/example2 in your JiBX installation) useful. This starts from code to generate the WSDL, but does return arrays. In general, the schema you're using for your web service should have a message element which corresponds to the result of the operation, and within that should be a repeating child element representing the array.
Hope that helps, - Dennis Dennis M. Sosnoski SOA and Web Services in Java Training and Consulting http://www.sosnoski.com - http://www.sosnoski.co.nz Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117 Madock Chiwenda wrote: > Is it possible to unmarshall objects into collection/array without > declaring a collection/array as a field in another object? > > I have object array returned from a webservice. I can unmarshall a > single object but I do not know how to map it without changing the > webservice to return a single object with an array field in it. > > regards, > Madock > On Mon, May 18, 2009 at 8:57 PM, Serkan Camurcuoglu > <serkan.camurcuo...@telenity.com > <mailto:serkan.camurcuo...@telenity.com>> wrote: > > It seems like you're trying to do a pretty standard thing. You should > use a jibx <collection> element in your binding. You should have a > field > of type collection in your object. You can check the example at > http://jibx.sourceforge.net/binding/tutorial/binding-collects.html , > the <collection field="notes"> binding does just what you want.. > > regards, > > SerkanC > > > > > Keith Bennett wrote: > > Hi, > > > > I am trying to configure JiBX to allow a repeating XML element to be > > unmarshalled into a single collection on a Java object. > Currently, I > > am coming across the following exception: > > > > 11:51:25,277 ERROR [STDERR] > > org.springframework.oxm.jibx.JibxUnmarshallingFailureException: JiBX > > unmarshalling exception: Expected > > "{http://service.webservice.company.com}code" start tag, found > > "{http://service.webservice.company.com}numberList" start tag > (line 4, > > col 10); nested exception is org.jibx.runtime.JiBXException: > Expected > > "{http://service.webservice.company.com}code" start tag, found > > "{http://service.webservice.compnay.com}numberList" start tag > (line 4, > > col 10) > > > > > > Below is the JiBX binding file as it is currently defined: > > > > <binding direction="input"> > > <namespace uri="http://service.webservice.company.com" > > default="elements" /> > > <mapping name="retrieveItemList" > > class="com.company.ItemServiceContract"> > > <value name="customerId" field="customerId" > nillable="true" /> > > <structure allow-repeats="true" ordered="false"> > > <value name="numberList" > set-method="addNumber" nillable="true" > > ordered="false" /> > > </structure> > > <value name="code" field="code" nillable="true" /> > > <value name="year" field="year" /> > > </mapping> > > </binding> > > > > Here's the schema for the request XML: > > > > <soapenv:Envelope xmlns:q0="http://service.webservice.company.com" > > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" > > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> > > <soapenv:Body> > > <q0:retrieveItemList> > > <q0:customerId xsi:nil="true"/> > > <q0:numberList>5697412</q0:numberList> > > <q0:numberList>7825272</q0:numberList> > > <q0:code>19</q0:code> > > <q0:year>2009</q0:year> > > </q0:retrieveItemList> > > </soapenv:Body> > > </soapenv:Envelope> > > > > I am using JiBX version 1.2.1. If I include a single numberList > > element in the request, the request is processed successfully. As > > soon as I add the second one, that's when I get the exception. Does > > anyone know how to do what I am trying to do? I thought that the > > allow-repeats would do the trick, but it isn't. I haven't been able > > to figure a way to do this. I tried using a JiBX collection, but I > > didn't know how to take the multiple repeating XML elements and > > consolidate them into a single Java collection. > > > > I appreciate your help with this. > > > > Keith > > > > > > ------------------------------------------------------------------------------ > > Crystal Reports - New Free Runtime and 30 Day Trial > > Check out the new simplified licensing option that enables > > unlimited royalty-free distribution of the report engine > > for externally facing server and web deployment. > > http://p.sf.net/sfu/businessobjects > > _______________________________________________ > > jibx-users mailing list > > jibx-users@lists.sourceforge.net > <mailto:jibx-users@lists.sourceforge.net> > > https://lists.sourceforge.net/lists/listinfo/jibx-users > > > > > > ------------------------------------------------------------------------------ > Crystal Reports - New Free Runtime and 30 Day Trial > Check out the new simplified licensing option that enables > unlimited royalty-free distribution of the report engine > for externally facing server and web deployment. > http://p.sf.net/sfu/businessobjects > _______________________________________________ > jibx-users mailing list > jibx-users@lists.sourceforge.net > <mailto:jibx-users@lists.sourceforge.net> > https://lists.sourceforge.net/lists/listinfo/jibx-users > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Crystal Reports - New Free Runtime and 30 Day Trial > Check out the new simplified licensing option that enables > unlimited royalty-free distribution of the report engine > for externally facing server and web deployment. > http://p.sf.net/sfu/businessobjects > ------------------------------------------------------------------------ > > _______________________________________________ > jibx-users mailing list > jibx-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jibx-users > ------------------------------------------------------------------------------ Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers & brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, & iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://www.creativitycat.com _______________________________________________ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users