[英]Problems when generating classes with JAXB - no @XmlRootElement
When I run the JAXB plugin, the files are created, but without @XmlRootElement for this reason I need to include this annotation manually in addition to adding an "extends" to the class, however whenever the project is updated the change is undone:当我运行 JAXB 插件时,会创建文件,但没有 @XmlRootElement 出于这个原因,除了向类添加“扩展”之外,我还需要手动包含此注释,但是每当项目更新时,更改都会撤消:
@XmlRootElement
public class BuscarVeiculo extends BuscarGenericDao {
My pom.xml looks like this:我的 pom.xml 看起来像这样:
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.14.0</version>
<executions>
<execution>
<id>veiculo</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaLanguage>WSDL</schemaLanguage>
<schemaDirectory>${project.basedir}/src/main/resources/wsdl</schemaDirectory>
<schemaIncludes>
<include>VeiculoWS.wsdl</include>
</schemaIncludes>
<generatePackage>com.pmdf.soap.api.soap.project.veiculo</generatePackage>
<generateDirectory>${project.basedir}/src/main/java</generateDirectory>
</configuration>
</execution>
</executions>
</plugin>
In the code below I make the call:在下面的代码中,我拨打了电话:
@Service
public class SoapClientService {
@Autowired
private Jaxb2Marshaller marshaller;
private WebServiceTemplate template;
public JAXBElement<?> findMyObject(FindGenericDao request, String URI) {
template = new WebServiceTemplate(marshaller);
JAXBElement<?> vehicle = (JAXBElement<?>) template.marshalSendAndReceive(URI , request);
return vehicle;
}
}
我使用错误的插件来处理wsdl,实际上我应该使用jaxws-maven-plugin。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.