0

I have generated some java classes from a wsdl and I'm now trying to marshal them to an xml. Here is my java code that does what I've explained

JAXBContext jaxbContext     = JAXBContext.newInstance( EnviarFacturaRequest.class );
Marshaller jaxbMarshaller   = jaxbContext.createMarshaller();
jaxbMarshaller.marshal(efr, new PrintWriter( System.out ));

When I run this code it tells me that the @XmlRootElement is missing. Would I be able to modify the generated classes to add the tag myself? I have gone to the class but eclipse warns me about editting the derived classes.

  • 1
    Does this answer your question? [unable to marshal type as an element because it is missing an @XmlRootElement annotation for auto generated classes](https://stackoverflow.com/questions/24519449/unable-to-marshal-type-as-an-element-because-it-is-missing-an-xmlrootelement-an) – sanjeevRm Jun 17 '21 at 11:16
  • Or [this](https://stackoverflow.com/q/819720/6413377)? – pirho Jun 17 '21 at 15:34
  • Thanks pirho, hadn't found that thread before and it helps me a lot – CharlieWhisky Jun 18 '21 at 16:11

0 Answers0