Mik*_*ike 0 java wsdl web-services wsdl2java maven
这是一个wsdl服务链接:http://www.webservicemart.com/uszip.asmx? WSDL
如果我运行以下命令:
wsimport -s src -d bin http://www.webservicemart.com/uszip.asmx?WSDL
此命令在/ src目录中生成Java源代码,并在/ bin目录中生成相对于发出命令的目录的已编译.class文件.这些生成的类可用于访问远程Web服务.
通过发出以下命令,创建了一个jar文件zipws.jar,其中包含com.webservicemart.ws包中的类:
我可以将这个jar添加到java项目的构建路径中并使用它.
有没有办法让我可以用maven2创建一个java项目,并在POM.xml中指定这个wsdl url并将jar直接下载到我的本地机器中?如果您需要更多信息,请与我们联系.
小智 6
你可以使用jaxws-maven-plugin:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.webservicemart.ws</groupId>
<artifactId>uszip</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.2.8</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<wsdlUrls>
<wsdlUrl>http://www.webservicemart.com/uszip.asmx?WSDL</wsdlUrl>
</wsdlUrls>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
该wsdlUrls参数允许您指定WSDL文件的位置.与手动运行一样wsimport,在构建项目时会自动下载文件.
| 归档时间: |
|
| 查看次数: |
8510 次 |
| 最近记录: |