E:\刘庆\webservice\axis2-1.5.4-bin\axis2-1.5.4\bin>wsdl2java -p com.client.test
-uri http://localhost:8080/springWebService/services/userWebService?wsdl
//说明这里-p 后面是指包名
-uri 后面是wsdl 文件路径名
最后:用命令生成客户端代码
package com.client.test;
import com.test.webservice.UserWebServiceStub;
public class Test {
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
tes();
}
public static void tes() throws Exception {
UserWebServiceStub stub = new UserWebServiceStub("http://192.168.0.86:8080/bs_interface/services/userWebService?wsdl");
UserWebServiceStub.SetUserInfoService se = new UserWebServiceStub.SetUserInfoService();
UserWebServiceStub.Say say = new UserWebServiceStub.Say();
say.setStr(" I'm Webservice Client");
UserWebServiceStub.SayResponse rep = stub.say(say);
System.out.println(rep.get_return());
}
}
输出结果
log4j:WARN No appenders could be found for logger (org.apache.axis2.description.AxisService).
log4j:WARN Please initialize the log4j system properly.
Web Server I'm Webservice Client