1.
在项目的根下建立
build-lib/axis
目录,并拷贝以下文件到目录下:
activation.jar
axis.jar
axis-ant.jar
commons-discovery-0.2.jar
commons-logging-1.0.4.jar
jaxrpc.jar
log4j-1.2.8.jar
log4j.properties
mail.jar
saaj.jar
wsdl4j-1.5.1.jar
2.
在工程的根下建立
build.xml
文件,内容如下:
<?
xml
version
=
"1.0"
encoding
=
"UTF-8"
?>
<
project
name
=
"webservice"
default
=
"all"
basedir
=
"."
>
<
property name=
"build.lib.dir" value="build-lib"
/>
<!-- change these variable base on your environment -->
<
property
name
=
"src.dir"
value
=
"src"
/>
<
property
name
=
"classpath"
value
=
"${build.lib.dir}/axis"
/>
<
property
name
=
"remote.wsdl"
value
=
"http://10.64.3.20/test/ws/Service1.asmx?wsdl"
/>
<
property
name
=
"webservice.namespace"
value
=
"http://tempurl.org"
/>
<
path
id
=
"axis.classpath"
>
<
fileset
dir
=
"${classpath}"
>
<
include
name
=
"**/*.jar"
/>
</
fileset
>
</
path
>
<
taskdef
resource
=
"axis-tasks.properties"
classpathref
=
"axis.classpath"
/>
<
target
name
=
"wsdl2java"
description
=
"Generate Java file from WSDL URL by WSDL2JAVA"
>
<
axis-wsdl2java
output
=
"${src.dir}"
testcase
=
"true"
verbose
=
"true"
url
=
"${remote.wsdl}"
>
<
mapping
namespace
=
"${webservice.namespace}"
package
=
"org.tempuri"
/>
</
axis-wsdl2java
>
</
target
>
<
target
name
=
"clean"
description
=
"Clean output directories"
>
<
delete
dir
=
"${src.dir}/org/tempuri"
/>
</
target
>
<
target
name
=
"all"
depends
=
"clean, wsdl2java"
>
</
target
>
</
project
>
注意:对应你的项目进行修改以上的变量设置
3.
直接运行
ant
,生成
webservice
的代理类,使用
eclipse
的
refactor
功能重命名包名
4.
调用本地代理类操作
webservice