1、maven
引用包
<!-- =========== websService生成java代码 开始 -->
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.3.5</version>
</dependency>
<!-- JAXB -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.1</version>
<scope>runtime</scope>
</dependency>
<!-- =========== websService生成java代码 结束 -->
配置plugin
<!-- =========== websService生成java代码 开始 -->
<plugin>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<wsdlUrls>
<wsdlUrl>file:///${project.basedir}/src/main/resources/citicsCoWebserviceService.xml</wsdlUrl>
</wsdlUrls>
<packageName>com.example.demo.cap.webserviceProxyClient3</packageName>
<sourceDestDir>${project.build.sourceDirectory}</sourceDestDir>
</configuration>
</execution>
</executions>
</plugin>
<!-- =========== websService生成java代码 结束 -->
2、maven的编译
点击maven生命周期中的compile,将java代码生成到指定包中
com.example.demo.cap.webserviceProxyClient3
3、命名空间替换
全局替换jakarta.为javax.
生产的代码
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlType;
替换为后不报错的代码
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;