axis stubs 开发web service

参考了:  http://blog.csdn.net/kay5804/article/details/2382428

 

1. 把相关的jar添加到C:\Tomcat 5.0\common\lib

2.

set AXIS_HOME=C:\Tomcat 5.0\webapps\axis
set AXIS_LIB=C:\Tomcat 5.0\webapps\axis\WEB-INF\lib
set CLASSPATH=.;%AXIS_LIB%\axis.jar;%AXIS_LIB%\axis-ant.jar;%AXIS_LIB%\commons-discovery-0.2.jar;%AXIS_LIB%\commons-logging-1.0.4.jar;%AXIS_LIB%\jaxrpc.jar;%AXIS_LIB%\log4j-1.2.8.jar;%AXIS_LIB%\saaj.jar;%AXIS_LIB%\wsdl4j-1.5.1.jar;%axis_lib%/mail.jar;%axis_lib%/xml.jar;%axis_lib%/xmlsec-1.4.4.jar;

java org.apache.axis.client.AdminClient -lhttp://localhost:9090/axis/services/stubs deploy.wsdd

java org.apache.axis.wsdl.WSDL2Java -p client http://localhost:9090/axis/services/stubs?wsdl

 

3. Server.java

package com.web.test;

public class Server {
 public String getBeanStr(UserBean bean){
        return"You Name:"+bean.getName() +
               " , You Age:" + bean.getAge();
     }
 
 
 public UserBean getBeanStr(String name, int age){
  UserBean user = new UserBean();
  user.setAge(age);
  user.setName(name);
  
  return user;
 }

}

 

4. UserBean.java

package com.web.test;

public class UserBean {
 private String name="";
    private int age ;
    public int getAge() {
       return age;
    }
 
    public void setAge(int age) {
       this.age = age;
    }
 
    public String getName() {
       return name;
    }
 
    public void setName(String name) {
       this.name = name;
    }
   
    public String toString() {
     return "Hello " + name + "("+ age + "), welcome to webservice study." ;
    }
   
  
}

 

5. RAD testing result:

axis stubs 开发web service_第1张图片

 

你可能感兴趣的:(axis stubs 开发web service)