[color=darkblue]可以不使用XFire的eclipse插件,直接使用ANT脚本,和XFire1.2.6的jar包即可生成WebService客户端
目录结构为:
build.xml
WsGen的文件夹(此处文件夹名随意,ant脚本中对应该文件夹名即可)
WsGen下建立client,lib文件夹,lib下置放xFire1.2.6所有jar包[/color]
[color=brown]Build.xml代码:[/color][code]
<project name="XFire-WsGen" basedir="./WsGen" default="wsgen">
<path id="maven.compile.classpath">
<fileset file="${basedir}/lib/*.jar"/>
</path>
<!-- Remove classes directory for clean build -->
<target name="clean" description="Prepare for clean build">
<delete dir="${basedir}/client"/>
<mkdir dir="${basedir}/client"/>
</target>
<target name="wsgen" depends="clean">
<taskdef name="WsGenTask" classname="org.codehaus.xfire.gen.WsGenTask" classpathref="maven.compile.classpath"/>
<WsGenTask outputDirectory="${basedir}/client" wsdl="http://localhost:8080/mytest/services/HelloWordService?wsdl" package="com.tongtech.webservice.client" overwrite="true"/>
</target>
</project>
[/code]
[color=green]需要修改WSDL的地址,另外,package为客户端生成后所在包的包名
执行ant打包即可生成,生成后可考到eclipse下运行调试[/color]
目录结构为:
build.xml
WsGen的文件夹(此处文件夹名随意,ant脚本中对应该文件夹名即可)
WsGen下建立client,lib文件夹,lib下置放xFire1.2.6所有jar包[/color]
[color=brown]Build.xml代码:[/color][code]
<project name="XFire-WsGen" basedir="./WsGen" default="wsgen">
<path id="maven.compile.classpath">
<fileset file="${basedir}/lib/*.jar"/>
</path>
<!-- Remove classes directory for clean build -->
<target name="clean" description="Prepare for clean build">
<delete dir="${basedir}/client"/>
<mkdir dir="${basedir}/client"/>
</target>
<target name="wsgen" depends="clean">
<taskdef name="WsGenTask" classname="org.codehaus.xfire.gen.WsGenTask" classpathref="maven.compile.classpath"/>
<WsGenTask outputDirectory="${basedir}/client" wsdl="http://localhost:8080/mytest/services/HelloWordService?wsdl" package="com.tongtech.webservice.client" overwrite="true"/>
</target>
</project>
[/code]
[color=green]需要修改WSDL的地址,另外,package为客户端生成后所在包的包名
执行ant打包即可生成,生成后可考到eclipse下运行调试[/color]