Everything is a contribution

走过Java的点点滴滴,与大家共勉~
随笔 - 21, 文章 - 0, 评论 - 10, 引用 - 0
数据加载中……

Java调用DotNet的webservice

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

posted on 2006-08-21 16:55 Kevin Xia 阅读(1917) 评论(2)  编辑  收藏 所属分类: Java开发

评论

# re: Java调用DotNet的webservice  回复  更多评论   

老大,你怎么不上线了?好像失踪了啊
2006-09-07 18:06 | wangcheng

# re: Java调用DotNet的webservice  回复  更多评论   

晕呀~我现在只能上msn了, msn: 1eq2@sina.com
2006-10-09 16:59 | Kevin Xia

只有注册用户登录后才能发表评论。


网站导航: