Examples of SMSDeliveryReceiptSubscriptionResponse


Examples of org.gsm.oneapi.responsebean.sms.SMSDeliveryReceiptSubscriptionResponse

  @param callbackData (optional) will be passed back to the notifyURL location, so you can use it to identify the message the delivery receipt relates to (or any other useful data, such as a function name)

  @see SMSDeliveryReceiptSubscriptionResponse
  */
  public SMSDeliveryReceiptSubscriptionResponse subscribeToDeliveryNotifications(String senderAddress, String clientCorrelator, String notifyURL, String callbackData) {
    SMSDeliveryReceiptSubscriptionResponse response=new SMSDeliveryReceiptSubscriptionResponse();

    if (senderAddress!=null && notifyURL!=null) {
      FormParameters formParameters=new FormParameters();
      formParameters.put("clientCorrelator", clientCorrelator);
      formParameters.put("notifyURL", notifyURL);
      formParameters.put("callbackData", callbackData);
     
        int responseCode=0;
          String contentType = null;
     
      try {
        String endpoint=endPoints.getSMSDeliverySubscriptionsEndpoint().replaceAll("\\{senderAddress\\}", URLEncoder.encode(senderAddress, "utf-8"));
       
        if (dumpRequestAndResponse) JSONRequest.dumpRequestVariables(endpoint, authorisationHeader, formParameters);
 
        HttpURLConnection con = JSONRequest.setupConnection(endpoint, authorisationHeader);
            con.setDoOutput(true);
            OutputStreamWriter out = new OutputStreamWriter(con.getOutputStream());
           
            String requestBody=JSONRequest.formEncodeParams(formParameters);
            out.write(requestBody);
            out.close();
 
            responseCode=con.getResponseCode();
              contentType = con.getContentType();
           
              response=smsDeliveryReceiptSubscriptionProcessor.getResponse(con, OneAPIServlet.CREATED);
      } catch (Exception e) {
        response.setHTTPResponseCode(responseCode);
        response.setContentType(contentType);
       
        response.setRequestError(new RequestError(RequestError.SERVICEEXCEPTION, "SVCJAVA", e.getMessage(), e.getClass().getName()));
        logger.error("Exception "+e.getMessage()+" "+e.getLocalizedMessage());
      }
    }
    return response;
  }
View Full Code Here

Examples of org.gsm.oneapi.responsebean.sms.SMSDeliveryReceiptSubscriptionResponse

      logger.debug("No response obtained");
    }
   
    logger.debug("Register a delivery report receipt notification endpoint="+serviceEndpoints.getSMSDeliverySubscriptionsEndpoint());
   
    SMSDeliveryReceiptSubscriptionResponse deliveryReceiptSubcription=me.subscribeToDeliveryNotifications("tel:12345", "ref12345", notifyURL, "subscription1");
    if (deliveryReceiptSubcription!=null) {
      logger.debug("SMSDeliveryReceiptSubscriptionResponse="+deliveryReceiptSubcription.toString());
    } else {
      logger.debug("No response obtained");
    }

    logger.debug("Cancel delivery receipt notification endpoint="+serviceEndpoints.getCancelSMSDeliverySubscriptionEndpoint());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.