webservice生成进程
webservice生成过程1、写接口方法和beanpublic interface Auth {public Response auth(Request request)}p
webservice生成过程
1、写接口方法和bean
public interface Auth {public Response auth(Request request);}public class Request {private int type;private String userid;private String password;public int getType() {return type;}public void setType(int type) {this.type = type;}public String getUserid() {return userid;}public void setUserid(String userid) {this.userid = userid;}public String getPassword() {return password;}public void setPassword(String password) {this.password = password;}}public class Response {private String result;private String resultDesc;public String getResult() {return result;}public void setResult(String result) {this.result = result;}public String getResultDesc() {return resultDesc;}public void setResultDesc(String resultDesc) {this.resultDesc = resultDesc;}}
2、生成wdsl,使用如下bat文件,保证能根据其中Class配置找到Auth.class文件,此处是与class文件的com目录同级
set Axis_Lib=D:\workspace\webapps\WEB-INF\libset Java_Cmd=java -Djava.ext.dirs=%Axis_Lib%set Package=com.productset Class=com.product.Authset Axis_Servlet=http://auth.com/services/auth %Java_Cmd% org.apache.axis.wsdl.Java2WSDL -o Auth.wsdl -l%Axis_Servlet% -n "%Axis_Servlet%" -p%Package% "%Axis_Servlet%" %Class%
3、根据生成的wdsl文件,使用如下bat文件,生成客户端与服务端代码,客户端调用方法参见生成的**Test类,服务端实现**Impl类里的方法
set Axis_Lib=D:\workspace\webapps\WEB-INF\libset Java_Cmd=java -Djava.ext.dirs=%Axis_Lib%set Output_Path=D:\workspace\test\javasrcset Package=com.authset Axis_Servlet=http://auth.com/services/auth %Java_Cmd% org.apache.axis.wsdl.WSDL2Java -o%Output_Path% -d Session -s -S true -t -N%Axis_Servlet%=%Package% Auth.wsdl