下载地址
链接 : https://archive.apache.org/dist/axis/axis2/java/core/1.8.0/axis2-1.8.0-bin.zip
生成webservice步骤
1.打开cmd命令行,切换(cd)到axis2的bin目录
2.运行命令:
wsdl2java -uri http://www.webxml.com.cn/WebServices/RandomFontsWebService.asmx?wsdl
这时到axis2的bin目录下会发现出现了一个src目录,如下图所示:
参数含义
-uri:wsdl文件所在路径
-p: 指定了生成的Java类的包名,如com.client
-o : 指定了生成的一系列文件保存的根目录。在执行完上面的命令后,
代码示例
- 以下可以忽略不看
RandomFontsWebServiceCallbackHandler.java
/**
* RandomFontsWebServiceCallbackHandler.java
*
* This file was auto-generated from WSDL
* by the Apache Axis2 version: 1.7.9 Built on : Nov 16, 2018 (12:05:37 GMT)
*/
package java;
/**
* RandomFontsWebServiceCallbackHandler Callback class, Users can extend this class and implement
* their own receiveResult and receiveError methods.
*/
public abstract class RandomFontsWebServiceCallbackHandler {
protected Object clientData;
/**
* User can pass in any object that needs to be accessed once the NonBlocking
* Web service call is finished and appropriate method of this CallBack is called.
* @param clientData Object mechanism by which the user can pass in user data
* that will be avilable at the time this callback is called.
*/
public RandomFontsWebServiceCallbackHandler(Object clientData) {
this.clientData = clientData;
}
/**
* Please use this constructor if you don't want to set any clientData
*/
public RandomFontsWebServiceCallbackHandler() {
this.clientData = null;
}
/**
* Get the client data
*/
public Object getClientData() {
return clientData;
}
/**
* auto generated Axis2 call back method for getCharFonts method
* override this method for handling normal response from getCharFonts operation
*/
public void receiveResultgetCharFonts(
java.RandomFontsWebServiceStub.GetCharFontsResponse result) {
}
/**
* auto generated Axis2 Error handler
* override this method for handling error response from getCharFonts operation
*/
public void receiveErrorgetCharFonts(java.lang.Exception e) {
}
/**
* auto generated Axis2 call back method for getChineseFonts method
* override this method for handling normal response from getChineseFonts operation
*/
public void receiveResultgetChineseFonts(
java.RandomFontsWebServiceStub.GetChineseFontsResponse result) {
}
/**
* auto generated Axis2 Error handler
* override this method for handling error response from getChineseFonts operation
*/
public void receiveErrorgetChineseFonts(java.lang.Exception e) {
}
}