我有这个错误:jsmpp.extra.NegativeResponseException:否定响应 00000001(消息长度无效)。会有什么问题?我正在使用 SMSC 模拟器,它返回给我一个消息 ID,但是当我将代码传递给我的测试团队时,他们收到错误,我该如何解决?
public static void main(String[] args) {
System.out.println("IPHOST "+ args[0] +" port"+ args[1] + " systemId"+ args[2]+
" systemType"+ args[3]+ " password "+ args[4]+" for "+ args[5]+ "mensaje " + args[6]+
"from " + args[7]+ "config " + args[8]);
SMPPSession session = new SMPPSession();
try {
Log.info("Connecting");
String systemId = session.connectAndBind(args[0], Integer.parseInt(args[1]), new BindParameter(BindType.BIND_TX, args[2], args[4], args[3], TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN, null));
Log.info("Connected with SMSC with system id {}", systemId);
try {
// String messageId = session.submitShortMessage("CMT",
// TypeOfNumber.INTERNATIONAL, NumberingPlanIndicator.UNKNOWN, "1616",
// TypeOfNumber.INTERNATIONAL, NumberingPlanIndicator.UNKNOWN, "593997787786",
// new ESMClass(), (byte)0, (byte)1, TIME_FORMATTER.format(new Date()), null,
// new RegisteredDelivery(SMSCDeliveryReceipt.DEFAULT), (byte)0, new GeneralDataCoding(Alphabet.ALPHA_DEFAULT, MessageClass.CLASS1, false), (byte)0,
// "jSMPP simplify SMPP on Java platform".getBytes());
Principal principal= new Principal();
System.out.println(principal.obtenerPropiedad("notif.smpp.S.address.ton"));
String messageId ="";
if(args[8].equals("S")) {
messageId = session.submitShortMessage("CMT",
TypeOfNumber.ALPHANUMERIC,
NumberingPlanIndicator.ISDN,
args[7],
TypeOfNumber.INTERNATIONAL,
NumberingPlanIndicator.ISDN,
args[5],
new ESMClass(64),
(byte)0, (byte)1,null, null,
new RegisteredDelivery(SMSCDeliveryReceipt.DEFAULT),
(byte)0, new GeneralDataCoding(245),
(byte)0, args[6].getBytes());
}else if(args[8].equals("C")) {
messageId = session.submitShortMessage("CMT",
TypeOfNumber.INTERNATIONAL,
NumberingPlanIndicator.ISDN,
args[7],
TypeOfNumber.INTERNATIONAL,
NumberingPlanIndicator.ISDN,
args[5],
new ESMClass(64),
(byte)0, (byte)1,null, null,
new RegisteredDelivery(SMSCDeliveryReceipt.DEFAULT),
(byte)0, new GeneralDataCoding(245),
(byte)0, args[6].getBytes());
}
Log.info("Message submitted, message_id is {}", messageId);
} catch (PDUException e) {
// Invalid PDU parameter
Log.error("Invalid PDU parameter", e);
} catch (ResponseTimeoutException e) {
// Response timeout
Log.error("Response timeout", e);
} catch (InvalidResponseException e) {
// Invalid response
Log.error("Receive invalid response", e);
} catch (NegativeResponseException e) {
// Receiving negative response (non-zero command_status)
Log.error("Receive negative response", e);
} catch (IOException e) {
Log.error("IO error occurred", e);
}
session.unbindAndClose();
} catch (IOException e) {
Log.error("Failed connect and bind to host", e);
}
}
完整的错误堆栈是:
16:00:01.011 [main] INFO com.notificaciones.util.LoggerNotificacionesMDB - 连接 16:00:01.039 [main] INFO com.notificaciones.util.LoggerNotificacionesMDB - 与 SMSC 连接,系统 ID 为 12545 1 16:00:01.068 [main ] 错误 com.notificaciones.util.LoggerNotificacionesMDB - 收到否定响应 org.jsmpp.extra.NegativeResponseException:在 org.jsmpp.session.AbstractSession.validateResponse(AbstractSession.java:284) 找到否定响应 00000001(消息长度无效)~[ notifysat-0.0.1-jar-with-dependenciesVersion2.jar:?] at org.jsmpp.session.AbstractSession.executeSendCommand(AbstractSession.java:345) ~[notifysat-0.0.1-jar-with-dependenciesVersion2.jar:? ] 在 org.jsmpp.session.SMPPSession.submitShortMessage(SMPPSession.java:384) ~[notifysat-0.0.1-jar-with-dependenciesVersion2.jar:?] 在 com.notifysat.Principal.main(Principal.java:117) [notifysat-0.0.1-jar-with-dependenciesVersion2.jar:?]
我正在使用:jsmpp 2.3.12-SNAPSHOT