import java.math.BigDecimal;
import java.net.MalformedURLException;
import java.rmi.RemoteException;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.xml.rpc.ServiceException;
import javax.xml.soap.SOAPException;
import org.apache.axis.message.SOAPHeaderElement;
import org.apache.axis.types.URI.MalformedURIException;
import cn.com.chinatelecom.util.MD5;
import cn.com.chinatelecom.www.schema.ctcc.common.v2_1.ChargingInformation;
import cn.com.chinatelecom.www.schema.ctcc.common.v2_1.PolicyException;
import cn.com.chinatelecom.www.schema.ctcc.common.v2_1.SimpleReference;
import
cn.com.chinatelecom.www.wsdl.ctcc.sms.send.v2_1.service.SendSmsBindingStub;
import
cn.com.chinatelecom.www.wsdl.ctcc.sms.send.v2_1.service.SendSmsServiceLocator;
import cn.com.chinatelecom.www.wsdl.ctcc.sms.send.v2_1._interface.SendSms;
public class SendSmsTest {
public static void main(String[] args) {
SOAPHeaderElement SoapHeader = new SOAPHeaderElement(
"http://www.tncc.com.cn/",
"RequestSOAPHeader");
try {
SoapHeader.addChildElement("spId").addTextNode("12323"); // SpID
((SendSmsBindingStub) sendSms).setHeader(SoapHeader); // 添加SOAP头
org.apache.axis.types.URI[] addresses = new org.apache.axis.types.URI[1];
addresses[0] = new org.apache.axis.types.URI("");
/* 设置ChargingInformation */
ChargingInformation charging = new ChargingInformation();
charging.setDescription("gm");// 描述
charging.setAmount(new BigDecimal(1)); SimpleReference receiptRequest = new SimpleReference();
receiptRequest.setCorrelator("1001559");
receiptRequest.setInterfaceName("SmsNotificationService");
receiptRequest.setEndpoint(new org.apache.axis.types.URI(
"http://开头的接收短信状态报告的webserivce地址,后续章节会讲")); } catch (ServiceException e) {
e.printStackTrace();
} catch (SOAPException e) {
e.printStackTrace();
} catch (MalformedURIException e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
}
}
}
}
不懂java,只会一丁点
import java.net.MalformedURLException;
import java.rmi.RemoteException;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.xml.rpc.ServiceException;
import javax.xml.soap.SOAPException;
import org.apache.axis.message.SOAPHeaderElement;
import org.apache.axis.types.URI.MalformedURIException;
import cn.com.chinatelecom.util.MD5;
import cn.com.chinatelecom.www.schema.ctcc.common.v2_1.ChargingInformation;
import cn.com.chinatelecom.www.schema.ctcc.common.v2_1.PolicyException;
import cn.com.chinatelecom.www.schema.ctcc.common.v2_1.SimpleReference;
import
cn.com.chinatelecom.www.wsdl.ctcc.sms.send.v2_1.service.SendSmsBindingStub;
import
cn.com.chinatelecom.www.wsdl.ctcc.sms.send.v2_1.service.SendSmsServiceLocator;
import cn.com.chinatelecom.www.wsdl.ctcc.sms.send.v2_1._interface.SendSms;
public class SendSmsTest {
public static void main(String[] args) {
SOAPHeaderElement SoapHeader = new SOAPHeaderElement(
"http://www.tncc.com.cn/",
"RequestSOAPHeader");
try {
SoapHeader.addChildElement("spId").addTextNode("12323"); // SpID
((SendSmsBindingStub) sendSms).setHeader(SoapHeader); // 添加SOAP头
org.apache.axis.types.URI[] addresses = new org.apache.axis.types.URI[1];
addresses[0] = new org.apache.axis.types.URI("");
/* 设置ChargingInformation */
ChargingInformation charging = new ChargingInformation();
charging.setDescription("gm");// 描述
charging.setAmount(new BigDecimal(1)); SimpleReference receiptRequest = new SimpleReference();
receiptRequest.setCorrelator("1001559");
receiptRequest.setInterfaceName("SmsNotificationService");
receiptRequest.setEndpoint(new org.apache.axis.types.URI(
"http://开头的接收短信状态报告的webserivce地址,后续章节会讲")); } catch (ServiceException e) {
e.printStackTrace();
} catch (SOAPException e) {
e.printStackTrace();
} catch (MalformedURIException e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
}
}
}
}
不懂java,只会一丁点
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货