关于spring beanfactory 的一些说明:
http://www.tuicool.com/articles/mm2q6rj
Class.forName()、Class.forName().newInstance() 、New 三者区别!
http://www.cnblogs.com/shosky/archive/2011/07/22/2114290.html
java 泛型解析
http://blog.csdn.net/zi_jun/article/details/9160837
************************************************************
package com.nari.misp.webservice.modules.sms.area;
import javax.xml.namespace.QName;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.rpc.client.RPCServiceClient;
import org.apache.log4j.Logger;
import com.nari.misp.common.config.Global;
/**
*
*
* @ClassName: YunNan
*
* @Description: 云南提供的短信接口调用
*
* @author Comsys-Hoperun
*
* @date 2016年3月8日 下午2:03:05
*
*
*/
public class YunNan {
private static final Logger logger = Logger.getLogger(ChaoGaoYa.class);
/**
* 电话号码
*/
String [] tels;
/**
* 发送的消息内容
*/
String [] sendContent;
/**
* 发送类型: 群发(0默认) 组发(1)
*/
String sendType;
/**
*
* 创建一个新的实例 YunNan.
* <p>Title: </p>
* <p>Description: </p>
* @param tels
* @param sendContent
* @param sendType
*/
public YunNan (String [] tels, String [] sendContent, String sendType){
this.tels = tels;
this.sendContent = sendContent;
this.sendType = sendType;
}
private static RPCServiceClient serviceClient = null;
static {
try {
serviceClient = new RPCServiceClient();
} catch (AxisFault e) {
e.printStackTrace();
}
}
/**
*
* sendSMS(调用云南发送的短信接口)
* @Title: sendSMS
* @Description: 使用RPCServiceClient方式调用
* @param @return 设定文件
* @return String 返回类型
* @throws
*/
public String sendSMS(){
String sendResult = "";
try {
// WSDL地址
final String endpoint = Global.getConfig("sms.endpointUrl");
// 设置要使用哪个业务进行下发
String opName1 = "setYw_id";
// 设置具体的业务类型
String opName2 = "setBusinessDetail";
// 短信群发
String opName3 = "multiSend";
String from = "";
Object[] opArgs = new Object[] {tels, sendContent[0], from, Global.getConfig("sms.userName"), Global.getConfig("sms.pawd")};
Class<?>[] opReturnType = new Class[] { String[].class };
Options options = serviceClient.getOptions();
EndpointReference targetEPR = new EndpointReference(endpoint);
options.setTo(targetEPR);
QName opQName1 = new QName("http://service.ws.sms.ipcc.ydtf.com", opName1);
// 设置要使用哪个业务进行下发。1-企业通知,2-电力公益短信,6-短信缴电费。
serviceClient.invokeRobust(opQName1, new Object[] {1});
QName opQName2 = new QName("http://service.ws.sms.ipcc.ydtf.com", opName2);
// 设置具体的业务类型,如:电力公益短信中包含有: DFTZ-电费通知, TDTZ-停电通知,YWJD-业务进度,CFDX-催费短信,PGDX-派工短信,QT-其他
// 企业通知包含有:HYTZ-会议通知,YWDX-业务短信,QT-其他
serviceClient.invokeRobust(opQName2, new Object[] {"YWDX"});
QName opQName3 = new QName("http://service.ws.sms.ipcc.ydtf.com", opName3);
Object[] ret = serviceClient.invokeBlocking(opQName3, opArgs, opReturnType);
sendResult = ((String[]) ret[0])[0];
logger.info("云南短信接口的返回值:" + sendResult);
} catch (Exception e) {
logger.error("云南的短信接口调用异常:" + e.getMessage());
sendResult = "系统异常";
}
return sendResult;
}
}