title: Sending Multiple Sms through SMPP
body: <p>I will come straight on my question.</p>
  
  <ol>
  <li><p>I am using Logica smpp and I want to send sms to multiple numbers. below code giving exception.</p>
  
  <pre><code>public void submitMulti() {
  String serviceType = "";        
  byte replaceIfPresentFlag = 0;
  String scheduleDeliveryTime = null;
  String validityPeriod = null;
  byte esmClass = 0;
  //######################
  //byte protocolId = 0;
  //byte dataCoding = 0;
  byte protocolId = 0; //0x00; commented is for flash
  byte dataCoding = (byte) 0x08; //0x18
  byte smsClass = 0x00;
  //######################
  byte ton = 1;
  byte npi = 1;
  byte priorityFlag = 0;
  byte registeredDelivery = 0;   //TODO registered delivery
  byte smDefaultMsgId =  (byte) 12; //0;
  try {
      SubmitMultiSM request = new SubmitMultiSM();
      SubmitMultiSMResp response;
  
      // input values and set some :-)
      String sourceAddress = "123456789012";
      int numberOfDestination = 10;
      for (int i = 0; i &lt; numberOfDestination; i++) {
          request.addDestAddress(new DestinationAddress(new Address(ton,npi,"923458503302")));
      }
  
      // set other values
      request.setServiceType(serviceType);
      request.setSourceAddr(sourceAddress);
      request.setReplaceIfPresentFlag(replaceIfPresentFlag);
      request.setShortMessage("Hy");
      request.setScheduleDeliveryTime(scheduleDeliveryTime);
      request.setValidityPeriod(validityPeriod);
      request.setEsmClass(esmClass);
      request.setProtocolId(protocolId);
      request.setPriorityFlag(priorityFlag);
      request.setRegisteredDelivery(registeredDelivery);
      request.setDataCoding(dataCoding);
      request.setSmDefaultMsgId(smDefaultMsgId);
      String ipAddress = Bundle.getInstance().getValue(Bundle.Application_Contants.IP_ADDRESS.toString());
      int port = Integer.valueOf(Bundle.getInstance().getValue(Bundle.Application_Contants.PORT.toString()));
      long receiveTimeOut = Long.valueOf(Bundle.getInstance().getValue(Bundle.Application_Contants.RECEIVE_TIMEOUT.toString()));
  
      TCPIPConnection connection = new TCPIPConnection(ipAddress,port);
      connection.setReceiveTimeout(receiveTimeOut);
      customSession = new Session(connection);
  
  
      // send the request
      System.out.println("Submit Multi request " + request.debugString());
      if (!asynchronous) {
          customSession.submitMulti(request);
      } else {
          response = customSession.submitMulti(request);
          System.out.println("Submit Multi response " + response.debugString());
          messageId = response.getMessageId();
      }
  
  } catch (Exception e) {
      log.error(e,e);
      System.out.println("Submit Multi operation failed. " + e.getMessage());
  } finally {
  }
  </code></pre>
  
  <p>}</p></li>
  </ol>
  
  <p>And the Exception is:</p>
  
  <pre><code>java.lang.NullPointerException
  at org.smpp.Session.send(Session.java:1100)
  at org.smpp.Session.send(Session.java:1173)
  at org.smpp.Session.submitMulti(Session.java:727)
  at com.noetic.topUpBooster.smpp.JarConnection.submitMulti(JarConnection.java:413)
  at com.noetic.sdp.alerts.JarCheck.run(JarCheck.java:34)
  Submit Multi operation failed. null
  </code></pre>
  
  <p>does anyone have idea?</p>