📄 smsroute.java~1~
字号:
package smsTest;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2005</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
import java.net.URL;
import cn.com.chinatelecom.www.schema.ctcc.sms.v2_1.*;
import org.apache.axis.types.*;
import org.apache.axis.client.Call;
import org.apache.axis.encoding.ser.BeanDeserializerFactory;
import org.apache.axis.encoding.ser.BeanSerializerFactory;
import cn.com.chinatelecom.www.schema.ctcc.common.v2_1.*;
import org.apache.axis.types.URI;
import com.zte.ctcc.sagTools.*;
import com.zte.ctcc.datastruct.sagConstants;
public class smsRoute {
private URL url = null;
private javax.xml.rpc.Service service = null;
private javax.xml.rpc.encoding.TypeMappingRegistry registry = null;
private javax.xml.rpc.encoding.TypeMapping map = null;
private org.apache.axis.client.Call call = null;
public smsRoute() {
}
public smsRoute(String urlstring) {
try{
url = new URL(urlstring);
service = new org.apache.axis.client.Service();
registry = service.getTypeMappingRegistry();
map = registry.getDefaultTypeMapping();
}catch(Exception e){
e.printStackTrace();
}
}
public java.lang.String sendSms(URI[] addresses, String senderName,
ChargingInformation charging, String message,
SimpleReference receiptRequest, RequestSOAPHeader header)
throws java.rmi.RemoteException,
cn.com.chinatelecom.www.schema.ctcc.common.v2_1.PolicyException,
cn.com.chinatelecom.www.schema.ctcc.common.v2_1.ServiceException {
try {
map.register(ChargingInformation.class, routeConstants.chargingQName7,
new BeanSerializerFactory(ChargingInformation.class,
routeConstants.chargingQName7),
new BeanDeserializerFactory(ChargingInformation.class,
routeConstants.chargingQName7));
map.register(SimpleReference.class, routeConstants.simpleReferQName7,
new BeanSerializerFactory(SimpleReference.class,
routeConstants.simpleReferQName7),
new BeanDeserializerFactory(SimpleReference.class,
routeConstants.simpleReferQName7));
initCall("sendSms");
setSoapHeader(header);
return (String) call.invoke(new Object[] {addresses, senderName,
charging, message, receiptRequest});
}
catch (Exception ex) {
ex.printStackTrace();
return null;
}
}
public java.lang.String sendSmsLogo(URI[] addresses, String senderName,
ChargingInformation charging, byte[] image,
SmsFormat smsFormat,
SimpleReference receiptRequest,
RequestSOAPHeader header)
throws java.rmi.RemoteException,
PolicyException,
ServiceException {
try {
map.register(SmsFormat.class, routeConstants.smsFormatQName7,
new BeanSerializerFactory(SmsFormat.class,
routeConstants.smsFormatQName7),
new BeanDeserializerFactory(SmsFormat.class,
routeConstants.smsFormatQName7));
map.register(ChargingInformation.class, routeConstants.chargingQName7,
new BeanSerializerFactory(ChargingInformation.class,
routeConstants.chargingQName7),
new BeanDeserializerFactory(ChargingInformation.class,
routeConstants.chargingQName7));
map.register(SimpleReference.class, routeConstants.simpleReferQName7,
new BeanSerializerFactory(SimpleReference.class,
routeConstants.simpleReferQName7),
new BeanDeserializerFactory(SimpleReference.class,
routeConstants.simpleReferQName7));
initCall("sendSmsLogo");
setSoapHeader(header);
return (String) call.invoke(new Object[] {addresses, senderName,
charging, image, smsFormat, receiptRequest});
}
catch (Exception ex) {
ex.printStackTrace();
return null;
}
}
public java.lang.String sendSmsRingtone(URI[] addresses, String senderName,
ChargingInformation charging, String ringtone,
SmsFormat smsFormat,
SimpleReference receiptRequest,
RequestSOAPHeader header)
throws java.rmi.RemoteException,
PolicyException,
ServiceException {
try {
map.register(SmsFormat.class, routeConstants.smsFormatQName7,
new BeanSerializerFactory(SmsFormat.class,
routeConstants.smsFormatQName7),
new BeanDeserializerFactory(SmsFormat.class,
routeConstants.smsFormatQName7));
map.register(ChargingInformation.class, routeConstants.chargingQName7,
new BeanSerializerFactory(ChargingInformation.class,
routeConstants.chargingQName7),
new BeanDeserializerFactory(ChargingInformation.class,
routeConstants.chargingQName7));
map.register(SimpleReference.class, routeConstants.simpleReferQName7,
new BeanSerializerFactory(SimpleReference.class,
routeConstants.simpleReferQName7),
new BeanDeserializerFactory(SimpleReference.class,
routeConstants.simpleReferQName7));
initCall("sendSmsRingtone");
setSoapHeader(header);
return (String) call.invoke(new Object[] {addresses, senderName,
charging, ringtone, smsFormat, receiptRequest});
}
catch (Exception ex) {
ex.printStackTrace();
return null;
}
}
public DeliveryInformation[] getSmsDeliveryStatus(String requestIdentifier,
RequestSOAPHeader header)
throws java.rmi.RemoteException,
cn.com.chinatelecom.www.schema.ctcc.common.v2_1.PolicyException,
cn.com.chinatelecom.www.schema.ctcc.common.v2_1.ServiceException {
try {
initCall("getSmsDeliveryStatus");
setSoapHeader(header);
return (DeliveryInformation[]) call.invoke(new Object[] {requestIdentifier});
}
catch (Exception ex) {
ex.printStackTrace();
return null;
}
}
public SmsMessage[] getReceivedSms(String registrationIdentifier,
RequestSOAPHeader header)
throws java.rmi.RemoteException,
cn.com.chinatelecom.www.schema.ctcc.common.v2_1.PolicyException,
cn.com.chinatelecom.www.schema.ctcc.common.v2_1.ServiceException {
try {
initCall("getReceivedSms");
setSoapHeader(header);
return (SmsMessage[]) call.invoke(new Object[] {registrationIdentifier});
}
catch (Exception ex) {
ex.printStackTrace();
return null;
}
}
public void notifySmsReception(String correlator, SmsMessage message,
NotifySOAPHeader header)
throws java.rmi.RemoteException {
try {
map.register(SmsMessage.class, routeConstants.smsMessageQName7,
new BeanSerializerFactory(SmsMessage.class,
routeConstants.smsMessageQName7),
new BeanDeserializerFactory(SmsMessage.class,
routeConstants.smsMessageQName7));
initCall("notifySmsReception");
setSoapHeader(header);
call.invoke(new Object[] {correlator, message});
}
catch (Exception ex) {
ex.printStackTrace();
}
}
public void notifySmsDeliveryReceipt(String correlator,
DeliveryInformation deliveryStatus,
NotifySOAPHeader header)
throws java.rmi.RemoteException {
try {
map.register(DeliveryInformation.class, routeConstants.deliveryInfoQName7,
new BeanSerializerFactory(DeliveryInformation.class,
routeConstants.deliveryInfoQName7),
new BeanDeserializerFactory(DeliveryInformation.class,
routeConstants.deliveryInfoQName7));
initCall("notifySmsDeliveryReceipt");
setSoapHeader(header);
call.invoke(new Object[] {correlator, deliveryStatus});
}
catch (Exception ex) {
ex.printStackTrace();
}
}
public void initCall(String apiName) {
try {
call = (org.apache.axis.client.Call) service.createCall();
call.setOperation(apiName);
call.setOperationName(routeConstants.getQName(apiName));
call.setTargetEndpointAddress(url);
//以下几项wp ok!!!
// call.setProperty(call.ATTACHMENT_ENCAPSULATION_FORMAT,
// call.ATTACHMENT_ENCAPSULATION_FORMAT_DIME);
// call.setUseSOAPAction(true);
// call.setSOAPActionURI("");
// call.setEncodingStyle(null);
call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR,
Boolean.FALSE);
call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS,
Boolean.FALSE);
// call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.
// SOAP11_CONSTANTS);
}
catch (Exception e) {
e.printStackTrace();
}
}
public void setSoapHeader(RequestSOAPHeader soapHeader) {
RouteSoapHeader routeSoap = new RouteSoapHeader(soapHeader);
routeSoap.setSoapHeader(call);
}
public void setSoapHeader(NotifySOAPHeader soapHeader) {
CodeSoapHeader routeSoap = new CodeSoapHeader(soapHeader);
routeSoap.setSoapHeader(call);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -