soap - order elements in response XML -


i have soapaction returns list of reports positions. positions should in order: sorted zorder attribute

before sending response list of positions sorted:

/*sort positions in report before adding list*/ list<position> orderedpositions = report.getpositions(); collections.sort(orderedpositions, new comparator<position>() {    @override    public int compare(position position, position position2) {       return position.getzorder().compareto(position2.getzorder());    } }); report.setpositions(orderedpositions); 

i checked list in correct order , is.

in response xml, elements of <positions> tag not in same order in java object. elements not seem ordered @ all. here excerpt:

<positions>    <chapter>911</chapter>    <chaptertype>lpk</chaptertype>    <formid>16972704</formid>    <materialnumber>121</materialnumber>    <positionid>s16977468</positionid>    <positiontext>-</positiontext>    <positiontype>work</positiontype>    <quantity>9.0</quantity>    <quantityunit>h</quantityunit>    <servicereport>16975051</servicereport>    <unitprice>0.0</unitprice>    <xmlid>16977468</xmlid>    <zorder>905</zorder> </positions> <positions>    <chapter>0</chapter>    <chaptertype>lpk</chaptertype>    <formid>16972704</formid>    <materialnumber></materialnumber>    <positionid>s16977469</positionid>    <positiontext></positiontext>    <positiontype>material</positiontype>    <quantity>1.0</quantity>    <quantityunit>st</quantityunit>    <servicereport>16975051</servicereport>    <unitprice>0.0</unitprice>    <xmlid>16977469</xmlid>    <zorder>1002</zorder> </positions> <positions>    <chapter>0</chapter>    <chaptertype>npk</chaptertype>    <formid>16972704</formid>    <materialnumber></materialnumber>    <positionid>s16977470</positionid>    <positiontext></positiontext>    <positiontype>material</positiontype>    <quantity>2.0</quantity>    <quantityunit>st</quantityunit>    <servicereport>16975051</servicereport>    <unitprice>0.0</unitprice>    <xmlid>16977470</xmlid>    <zorder>1003</zorder> </positions> <positions>    <chapter>0</chapter>    <chaptertype>lpk</chaptertype>    <formid>16972704</formid>    <materialnumber></materialnumber>    <positionid>s16977471</positionid>    <positiontext></positiontext>    <positiontype>material</positiontype>    <quantity>3.0</quantity>    <quantityunit>st</quantityunit>    <servicereport>16975051</servicereport>    <unitprice>0.0</unitprice>    <xmlid>16977471</xmlid>    <zorder>1004</zorder> </positions> 

how can positions elements in response xml sorted zorder attribute?


Comments