天天看点

AXIS 生成客户端

AXIS 生成客户端

如果碰到wsdl转java时出现[ERROR] rpc/encoded wsdls are not supported in JAXWS 2.0.这样错误的时候,可以尝试如下方法。

转:http://blog.csdn.net/lwei_998/article/details/6104375

简单记录操作过程: 

http://apache.etoak.com//ws/axis/1_4/

一、下载axis-bin-1_4.zip

1. http://apache.etoak.com//ws/axis/1_4/axis-bin-1_4.zip

2.解压axis-bin-1_4.zip

二、MyEclipse中新建project

 1.File ->new ->project->web project  

   Project name: wsdl

2.在项目中引入解压axis-bin-1_4.zip后axis-1_4/lib目录中所有的jar

3.在Run菜单中点击Run ->Java Applation

  Main tab 页中Project 填写信建的项目名称wsdl

  Main class 中填写 org.apache.axis.wsdl.WSDL2Java

  Arguments tab页中填写wsdl的名称或url

  如:http://127.0.0.1/webservice/InsurWebService?wsdl

4.点击run 就可以在wsdl项目中生成我们需要的java文件了

如果没有MyEclipse可以通过命令行来生成相关的java文件

1.编写axis.bat设置临时环境变量,有些jar包需要单独下载

set CLASSPATH=.;C:/Program Files/Java/jdk1.5.0_07/lib/tools.jar;D:/axis-1_4/lib/axis-ant.jar;D:/axis-1_4/lib/axis.jar;D:/axis-1_4/lib/commons-discovery-0.2.jar;D:/axis-1_4/lib/commons-logging-1.0.4.jar;D:/axis-1_4/lib/jaxrpc.jar;D:/axis-1_4/lib/log4j-1.2.8.jar;D:/axis-1_4/lib/log4j.properties;D:/axis-1_4/lib/saaj.jar;D:/axis-1_4/lib/wsdl4j-1.5.1.jar;D:/axis-1_4/lib/activation.jar;D:/axis-1_4/lib/javax.servlet.jar;D:/axis-1_4/lib/javax.servlet.jsp.jar;D:/axis-1_4/lib/jboss-j2ee.jar;D:/axis-1_4/lib/jboss-jaxrpc.jar;D:/axis-1_4/lib/jboss-jsr77.jar;D:/axis-1_4/lib/jboss-saaj.jar;D:/axis-1_4/lib/mail.jar;D:/axis-1_4/lib/namespace.jar;D:/axis-1_4/lib/xml-apis.jar;

 2.cmd进入命令行窗口

  D:/axis-1_4>axis.bat

  D:/axis-1_4>java org.apache.axis.wsdl.WSDL2Java http://127.0.0.1/webservice/InsurWebService?wsdl