微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

找到 JSMPP 否定响应 00000001消息长度无效

如何解决找到 JSMPP 否定响应 00000001消息长度无效

我有这个错误:jsmpp.extra.NegativeResponseException: Negative response 00000001 (Message Length is invalid)。 会有什么问题? 我正在使用 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,"1616","593997787786",//                    new ESMClass(),(byte)0,(byte)1,TIME_FORMATTER.format(new Date()),null,//                    new RegisteredDelivery(SMSCDeliveryReceipt.DEFAULT),new GeneralDataCoding(Alphabet.ALPHA_DEFAULT,MessageClass.CLASS1,false),//                    "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,args[5],new ESMClass(64),new RegisteredDelivery(SMSCDeliveryReceipt.DEFAULT),new GeneralDataCoding(245),args[6].getBytes()); 
        }else if(args[8].equals("C")) {
             messageId = session.submitShortMessage("CMT",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] 信息 com.notificaciones.util.LoggerNotificacionesMDB - 正在连接 16:00:01.039 [main] INFO com.notificaciones.util.LoggerNotificacionesMDB - 与系统 ID 12545 的 SMSC 连接 1 16:00:01.068 [main] 错误 com.notificaciones.util.LoggerNotificacionesMDB - 收到否定响应 org.jsmpp.extra.NegativeResponseException:找到否定响应 00000001(消息长度无效) 在 org.jsmpp.session.AbstractSession.validateResponse(AbstractSession.java:284) ~[notifysat-0.0.1-jar-with-dependenciesversion2.jar:?] 在 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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。