根據webservice地址生成java源碼

1、新建maven工程
2、pom.xml文件中加入如下配置:

<properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
   <dependency>
       <groupId>junit</groupId>
        <artifactId>junit</artifactId>
         <version>4.12</version>
    </dependency>
        ....
</dependencies>
<build>
        <plugins>
            <plugin>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-codegen-plugin</artifactId>
                <version>3.1.11</version>
                <executions>
                    <execution>
                        <id>generate-sources</id>
                        <phase>generate-sources</phase>
                        <configuration>
                            <!--源碼生成地址-->
                            <sourceRoot>${project.build.sourceDirectory}</sourceRoot>
                            <wsdlOptions>
                                <wsdlOption>
                                    <wsdl>http://xxx/services/userAPI?wsdl</wsdl>
                                </wsdlOption>
                            </wsdlOptions>
                        </configuration>
                        <goals>
                            <goal>wsdl2java</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
</build>

3、選擇Maven Project,點擊Execute Maven Goal,輸入generate-sources,點擊Execute

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章