Package org.gsm.oneapi.responsebean.mms

Examples of org.gsm.oneapi.responsebean.mms.MMSDeliveryReceiptSubscriptionResponse


  @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 MMSDeliveryReceiptSubscriptionResponse
  */
  public MMSDeliveryReceiptSubscriptionResponse subscribeToDeliveryNotifications(String senderAddress, String clientCorrelator, String notifyURL, String callbackData) {
    MMSDeliveryReceiptSubscriptionResponse response=new MMSDeliveryReceiptSubscriptionResponse();

    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.getMMSDeliverySubscriptionsEndpoint().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=mmsDeliveryReceiptSubscriptionProcessor.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

TOP

Related Classes of org.gsm.oneapi.responsebean.mms.MMSDeliveryReceiptSubscriptionResponse

Copyright © 2018 www.massapicom. 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.