2、根据其他采用短信发送WAP的朋友介绍,发送的时候需要设置cmpp的几个参数如下:
Msg_Fmt=4,TP_udhi=1,TP_pid=0,dcs=4 ,但是再使用东软SMIAS Java API 开发包时没有发现设置tp_udhi和dcs的地方,不知道是否在开发包中有其他对应设置这两个值的地方 ,或者采用其他的开发包?3、对于长度超过160的信息,如何使用这种方式发送?分成两条,如何设置相应发送的参数和信息体的header?4、发送代码如下,根据开发包中的示例修改的,发送的设置是否正确??
  public void pushByDongruan(PushActionForm pushActionForm, String pushMsg) throws IOException{    byte short_msg[] = new byte[150];    cmppe_submit sub = new cmppe_submit();    byte icp_id[] = new byte[10];
    icp_id[0] = 0x39;
    icp_id[1] = 0x31;
    icp_id[2] = 0x34;
    icp_id[3] = 0x32;
    icp_id[4] = 0x30;
    icp_id[5] = 0x35;
    icp_id[6] = 0;    byte mo_message_id[] = new byte[64];
    mo_message_id[0] = 0x31;
    mo_message_id[1] = 0x32;
    mo_message_id[2] = 0x33;
    mo_message_id[3] = 0x34;
    mo_message_id[4] = 0x35;
    mo_message_id[5] = 0x36;
    mo_message_id[6] = 0;    byte svc_type[] = new byte[6];
    svc_type[0] = 0x39;
    svc_type[1] = 0x31;
    svc_type[2] = 0x34;
    svc_type[3] = 0x32;
    //svc_type[4] = 0x30;
    //svc_type[5] = 0x35;
    byte fee_type = 1;    byte fee_user[] = new byte[CMPP.CMPPE_MAX_MSISDN_LEN];
    for (int i = 0; i < 12; i++)
      fee_user[i] = 0x0;
    fee_user[0] = 0x39;
    fee_user[1] = 0x31;
    fee_user[2] = 0x34;
    fee_user[3] = 0x32;
    fee_user[4] = 0x30;
    fee_user[5] = 0x35;
    //fee_user[6] = 0x35;
    //fee_user[7] = 0x33;
    //fee_user[8] = 0x31;
    //fee_user[9] = 0x31;
    //fee_user[10] = 0x31;
    //fee_user[11] = 0x0;    byte info_fee = 0;
    byte proto_id = 0;    byte msg_mode = 4; // 消息模式:0-不需要状态报告, 1-需要状态报告, 2-控制类型消息
    byte priority = 0;
    byte fee_utype = 2;    byte validate[] = new byte[10];
    validate[0] = 0;
    byte schedule[] = new byte[2];
    schedule[0] = 0;
    byte src_addr[] = new byte[12];
    for (int i = 0; i < 12; i++)
      src_addr[i] = 0x0;
    src_addr[0] = 0x39;
    src_addr[1] = 0x31;
    src_addr[2] = 0x34;
    src_addr[3] = 0x32;
    src_addr[4] = 0x30;
    src_addr[5] = 0x35;
    //src_addr[6] = 0x35;
    //src_addr[7] = 0x33;
    //src_addr[8] = 0x31;
    //src_addr[9] = 0x31;
    //src_addr[10] = 0x31;
    //src_addr[11] = 0x0;    String phoneNumStr = pushActionForm.getPhoneNum();
    String [] phoneNums = phoneNumStr.split(",");    byte du_count = (byte)phoneNums.length;
    byte dst_addr[][] = new byte[phoneNums.length + 1][15];    for(int i = 0;  i < phoneNums.length; i++){
      for(int j = 0; j < 11; j++)
      dst_addr[i][j] = phoneNums[i].getBytes()[j];
      dst_addr[i][11] = 0;
    }    //byte data_coding = 0;
    byte data_coding = 4;//binary    int sm_len = pushMsg.length();    //for (int i = 0; i < sm_len; i++)
      //short_msg[i] = 0x38;    short_msg = pushMsg.getBytes();    //sm_len = 8;
    //short_msg = "sms test".getBytes();    cmppe_result cr = new cmppe_result();
    cmppe_deliver_result rs = new cmppe_deliver_result();
    try {
      conn_desc con = new conn_desc();
      p.cmpp_connect_to_ismg("192.168.1.111", 7890, con);
      System.out.println("Connect Success");
      p.cmpp_login(con, "SP_ID", "pwd", (byte) 2, 0x12, 994573501);
      System.out.println("Login Success");
      readPa(con);
      System.out.println("Read Login response");      sub.set_icpid(icp_id);
      sub.set_svctype(svc_type);
      sub.set_feetype(fee_type);
      sub.set_infofee(info_fee);
      sub.set_protoid(proto_id);
      sub.set_msgmode(msg_mode);
      sub.set_priority(priority);
      sub.set_validate(validate);
      sub.set_schedule(schedule);
      sub.set_feeutype(fee_utype);
      sub.set_feeuser(fee_user);
      sub.set_srcaddr(src_addr);
      sub.set_ducount(du_count);
      sub.set_dstaddr(dst_addr);
      sub.set_msg(data_coding, sm_len, short_msg);
                //sub.printAllField();      for (int test_count = 0; test_count < 1; test_count++) {
        p.cmpp_submit(con, sub);
        System.out.println("Send submit success");
        readPa(con);
      }      for (int count = 0; count < 1; count++) {
        readPa(con);
      }
      p.cmpp_logout(con);
      readPa(con);
      System.in.read();
    }
    catch (Exception e) {
      System.out.println(e.getMessage());
      e.printStackTrace();
      System.out.println("have a exception");
      try {
        System.in.read();
      }
      catch (Exception e1) {
      }
      return;
    }  }
  static protected void readPa(conn_desc con) {
    cmppe_result cr = null;
    try {
      cr = p.readResPack(con);      switch (cr.pack_id) {
        case CMPP.CMPPE_NACK_RESP:
          System.out.println("------------get nack pack----------");
          break;        case CMPP.CMPPE_LOGIN_RESP:
          cmppe_login_result cl;
          cl = (cmppe_login_result) cr;
          System.out.println("------------login resp----------: STAT = " +
                             cl.stat);
          break;        case CMPP.CMPPE_LOGOUT_RESP:
          System.out.println("------------logout resp----------: STAT = " +
                             cr.stat);
          break;
        case CMPP.CMPPE_SUBMIT_RESP:
          cmppe_submit_result  sr;
          sr = (cmppe_submit_result)cr;
          System.out.println("------------submit resp----------: STAT = " +
                             sr.stat + " SEQ = " + sr.seq);
          System.out.println("--STAT = " + Integer.toHexString(sr.stat));
          break;        case CMPP.CMPPE_DELIVER:
          System.out.println("------------deliver---------: STAT = 0");
          cmppe_deliver_result cd = (cmppe_deliver_result) cr;
          p.cmpp_send_deliver_resp(con, cd.seq, cd.stat);          break;        case CMPP.CMPPE_CANCEL_RESP:
          System.out.println("---------cancel-----------: STAT = " + cr.stat);
          break;        case CMPP.CMPPE_ACTIVE_RESP:
          System.out.println("---------active resp-----------: STAT " + cr.stat);
          break;
        default:
          break;      }
    }
    catch (Exception e) {
      System.out.println(e.getMessage());
      e.printStackTrace();
      System.out.println("have a exception");
      try {
        System.in.read();
      }
      catch (Exception e1) {}    }
  }