Client快速调用接口

import javax.xml.soap.SOAPException;

import org.codehaus.xfire.client.Client;

/**

     * 发送短信
     *
     * @param phoneCodes
     *            手机号码(类型 String),支持使用分格符 ;的多个手机
     * @param message
     *            短信内容(类型 String),字数不要超过210个
     * @param userID
     *            授权用户ID(类型 String),必须!
     * @return String. ok:发送成功,no:授权用户ID或者ext错误,其他:异常处理代码。

     * @throws Exception

    * SendAppSms 为wsdl中方法的名字

     */
    public static String sendSms(String phoneCodes, String message) throws Exception {
        Object[] results = null;
        Object[] params = { phoneCodes, message, userID };
        Client client = new Client(new URL(WEBSERVICE_WSDL_URL));
        results = client.invoke("SendAppSms", params);

        return (String) results[0];
    }

猜你喜欢

转载自blog.csdn.net/babyxue/article/details/80433035