How to generate java class with @XmlRootElement from WSDL using xjc in command prompt

纵饮孤独 提交于 2019-12-13 17:21:53

问题


The xjc way of creating java package is

xjc -wsdl myWsdl.wsdl

This creates package like com

Then for generation of jar

jar cvf myJar.jar com/*

Any way to generate the java classes with @XmlRootElement because my java class does not have it.

PS: using command prompt only


回答1:


To force generating @XmlRootElement, refer How to generate @XmlRootElement Classes for Base Types in XSD? please.

However, I think you don't need to use @XmlRootElement. The post, No @XmlRootElement generated by JAXB indicates why xjc doesn't always generate @XmlRootElement.




回答2:


xjc tool does not have those options @XmlRootElement is not required.

Use the JAXBElement of the corresponding class in obj factory



来源:https://stackoverflow.com/questions/46042666/how-to-generate-java-class-with-xmlrootelement-from-wsdl-using-xjc-in-command-p

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!