Examples of RetrieveSMSResponse


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

  @param maxBatchSize (mandatory) is the maximum number of messages to retrieve in this request
      
  @see RetrieveSMSResponse
  */
  public RetrieveSMSResponse retrieveMessages(String registrationId, int maxBatchSize) {
    RetrieveSMSResponse response=new RetrieveSMSResponse();
   
    if (registrationId!=null && maxBatchSize>=0) {
     
          int responseCode=0;
            String contentType = null;

            try {
        logger.debug("endpoint="+endPoints.getRetrieveSMSEndpoint());
        String endpoint=endPoints.getRetrieveSMSEndpoint().replaceAll("\\{registrationId\\}", URLEncoder.encode(registrationId, "utf-8")).replaceAll("\\{maxBatchSize\\}", String.valueOf(maxBatchSize));
       
        if (dumpRequestAndResponse) JSONRequest.dumpRequestVariables(endpoint, authorisationHeader, null);
       
        HttpURLConnection con = JSONRequest.setupConnection(endpoint, authorisationHeader);
 
            responseCode=con.getResponseCode();
              contentType = con.getContentType();
             
              response.setHTTPResponseCode(responseCode);
              response.setContentType(contentType);
           
              response=retrieveSMSprocessor.getResponse(con, OneAPIServlet.OK);
      } catch (Exception e) {
        logger.error("Exception "+e.getMessage()+" "+e.getLocalizedMessage());
        e.printStackTrace();
        response.setHTTPResponseCode(responseCode);
        response.setContentType(contentType);
       
        response.setRequestError(new RequestError(RequestError.SERVICEEXCEPTION, "SVCJAVA", e.getMessage(), e.getClass().getName()));
      }
    }
    return response;
  }
View Full Code Here

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

    String authorisationHeader=JSONRequest.getAuthorisationHeader(username, password);
   
    SMSRetrieve me=new SMSRetrieve(serviceEndpoints, authorisationHeader);
   
    logger.debug("SMS receive endpoint="+serviceEndpoints.getRetrieveSMSEndpoint());   
    RetrieveSMSResponse retrieveResponse=me.retrieveMessages("3456", 2);       
    if (retrieveResponse!=null) {
      logger.debug("Have SMS retrieve response:\n"+retrieveResponse.toString());
    } else {
      logger.debug("No response obtained");
    }

    String notifyURL="http://test.com/notifyThis/Message="+JSONRequest.urlEncode("This is encoded");
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.