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:
@XmlRootElement
public class BuscarVeiculo extends BuscarGenericDao {
My pom.xml looks like this:
<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。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.