Array JAXB binding
alesj Nov 13, 2006 5:28 AMHow to bind the following object array?
My class:
@XmlRootElement(namespace = "www.geoplin.si/Gms") public class GMSWebSoapServerHistory implements Serializable { private HistoryObject[] collection; private Period period; private String mestoMeritve; private String vrstaMeritve; @XmlElementWrapper @XmlElement(namespace = "www.geoplin.si/Gms") public HistoryObject[] getCollection() { return collection; } public void setCollection(HistoryObject[] collection) { this.collection = collection; } @XmlElement(namespace="www.geoplin.si/Gms") public Period getPeriod() { return period; } public void setPeriod(Period period) { this.period = period; } @XmlElement(namespace="www.geoplin.si/Gms") public String getMestoMeritve() { return mestoMeritve; } public void setMestoMeritve(String mestoMeritve) { this.mestoMeritve = mestoMeritve; } @XmlElement(namespace="www.geoplin.si/Gms") public String getVrstaMeritve() { return vrstaMeritve; } public void setVrstaMeritve(String vrstaMeritve) { this.vrstaMeritve = vrstaMeritve; } }
And the coresponding XML (WS return):
<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:ns='www.geoplin.si/Gms' xmlns:ns0='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'> <SOAP-ENV:Header/> <SOAP-ENV:Body> <ns:GetMeritevAspectPeriodResponse xsi:type='ns:GetMeritevAspectPeriodResponse'> <return xmlns='' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='ns:GMSWebSoapServerHistory'> <ns:collection xmlns:ns='www.geoplin.si/Gms' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='ns:CollectionOfHistoryObject'> <ns:HistoryObject xmlns:ns='www.geoplin.si/Gms' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='ns:HistoryObject'> <ns:value xmlns:ns='www.geoplin.si/Gms' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='ns0:float'>1939.999872</ns:value> <ns:time xmlns:ns='www.geoplin.si/Gms' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='ns0:dateTime'>2006-11-12T11:00:00.000Z</ns:time> </ns:HistoryObject> <ns:HistoryObject xmlns:ns='www.geoplin.si/Gms' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='ns:HistoryObject'> <ns:value xmlns:ns='www.geoplin.si/Gms' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='ns0:float'>1899.999872</ns:value> <ns:time xmlns:ns='www.geoplin.si/Gms' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='ns0:dateTime'>2006-11-12T12:00:00.000Z</ns:time> </ns:HistoryObject> </ns:collection> <ns:vrstaMeritve xmlns:ns='www.geoplin.si/Gms' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='ns0:string'>alokacije</ns:vrstaMeritve> <ns:period xmlns:ns='www.geoplin.si/Gms' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='ns:Period'> <ns:end xmlns:ns='www.geoplin.si/Gms' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='ns0:dateTime'>2006-11-13T10:20:00.984Z</ns:end> <ns:start xmlns:ns='www.geoplin.si/Gms' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='ns0:dateTime'>2006-11-12T10:20:00.984Z</ns:start> </ns:period> <ns:mestoMeritve xmlns:ns='www.geoplin.si/Gms' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='ns0:string'>Q-P123</ns:mestoMeritve> </return> </ns:GetMeritevAspectPeriodResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
All other fields are binded ok, but I get a null on HistoryObject array.
Any annotation that I should use / overlooked?