因为项目需要,在网上查找了很多WSDL的使用方式,但是感觉不是特别顺利。现在是利用Maven 项目快速转化的方法。
首先建立一个maven 项目 ,并将下面的pom文件复制进去。
1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 2 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 3 <modelVersion>4.0.0</modelVersion> 4 5 <groupId>org.springframework.boot</groupId> 6 <artifactId>WebSeriveces</artifactId> 7 <version>0.0.1-SNAPSHOT</version> 8 <packaging>jar</packaging> 9 10 <name>WebSeriveces</name> 11 <url>http://maven.apache.org</url> 12 13 <properties> 14 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 15 </properties> 16 17 <dependencies> 18 <dependency> 19 <groupId>junit</groupId> 20 <artifactId>junit</artifactId> 21 <version>3.8.1</version> 22 <scope>test</scope> 23 </dependency> 24 </dependencies> 25 <build> 26 <plugins> 27 <plugin> 28 <artifactId>maven-compiler-plugin</artifactId> 29 <configuration> 30 <source>1.8</source> 31 <target>1.8</target> 32 </configuration> 33 </plugin> 34 <plugin> 35 <groupId>org.jvnet.jaxb2.maven2</groupId> 36 <artifactId>maven-jaxb20-plugin</artifactId> 37 <version>0.13.1</version> 38 <executions> 39 <execution> 40 <goals> 41 <goal>generate</goal> 42 </goals> 43 </execution> 44 </executions> 45 <configuration> 46 <schemaLanguage>WSDL</schemaLanguage> 47 <generatePackage>com.test.sample</generatePackage> 48 //转化之后的包 49 <schemas> 50 <schema> 51 <url>testsample.wsdl</url> 52 //需要转化的文件 53 </schema> 54 </schemas> 55 </configuration> 56 </plugin> 57 </plugins> 58 </build> 59 </project>
然后把要wsdl、xsd文件放到项目目录下。run maven build 即可。