Axis2生成webservice客户端代码

下载地址

链接 : 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) {
    }
}

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值