I have WSDL and XSD files describing some documents. I'm using apache axis 1.4 to generate Java proxy classes from WSDL schema. The classes are generated successfully but they don't contain annotations like @XmlRootElement, @XmlAttribute and others. Generated classes do not contain any annotations at all. Then I have xml files which I extract from JMS queue. I remove headers and try to deserialize (unmarshall) the xml to correct Java proxy class.
JAXBContext jc = JAXBContext.newInstance(SalesOrder.class);
StreamSource xml = new StreamSource("D:\\Sources\\NSJavaClientCRM2014-1\\data\\jms&SL_IN---salesorder2014_1.xml");
Unmarshaller unmarshaller = jc.createUnmarshaller();
JAXBElement<SalesOrder> je1 = unmarshaller.unmarshal(xml, SalesOrder.class);
SalesOrder salesOrder = je1.getValue();
as a result I get a lot of IllegalAnnotationsException like this:
com.netsuite.webservices.platform.core_2014_1.types.RecordType does not have a no-arg default constructor.
com.netsuite.webservices.platform.common_2014_1.types.AvsMatchCode does not have a no-arg default constructor.
I cannot add annotations manually, because the generated Java classes are really huge. This is the place where I'm stuck. So from my point of view the problem is in absence of XML annotations in Java proxy classes and I have no idea how to add them automatically when generating classes from wsdl schema. The question is complicated: We have WSDL and XSD schema and we have a lot of XML files created according to schema. How can I create correct Java proxy classes (with XML annotations or without) and easily do the marshalling / unmarshalling to/from ordinary XML files? Maybe there some options in axis?
No comments:
Post a Comment