Hi Everybody!
I've been working in a prototype around marshall and unmarshalling to
generate json documents to send as a response
in a servlet request, so once I unmarshall the xml file into a java object I
just use the json-lib library(json-lib.sourceforge.net/)
and all works propertly.
So, to test the prototype I developed a client, it request the servlet and
receives the json document as a response, then I
convert the json document into XML, once I did it I just want to unmarshall
again to populate my java object. bue I got the following
error message
junit.framework.AssertionFailedError: Error marshalling xml request: Element
with name after passed to type MyObject in incorrect order; expected element
with name 'before' or any other optional element declared prior to it.
at
edu.jeve.test.http.request.RequestJSONtoXMLTest.convertJSONtoXML(RequestJSONtoXMLTest.java:94)
at
edu.jeve.test.qatool.http.request.RequestJSONtoXMLTest.testJSONResponseToXML(RequestJSONtoXMLTest.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Note: It seems to me that json-lib I'm using just create the json document
from my java object passing the fields in alphabetic order
I mean from A.... to Z and I declare the fields into my schema in the
following order: before, after
So, basically I just need to change my schema, but is there any other way to
avoid this problem without modify the current schema?
Thanks in advance!