簡體   English   中英

未發送Plivo SMS並在Java中出現錯誤

[英]Plivo SMS is not being sent and getting error in Java

我正在將Plivo SMS API與我的java Web應用程序集成。 我想通過我的應用程序發送消息。 我指的是https://www.plivo.com/docs/getting-started/send-a-single-sms/ link。 以下是代碼段:

String authId = "{my Auth_id}"; //Your Authentication ID
String authToken = "{my auth Token}"; //Your authentication code
RestAPI api = new RestAPI(authId, authToken, "v1");

LinkedHashMap<String, String> parameters = new LinkedHashMap<String, String>();
parameters.put("src", "+44*******"); // Sender's phone number with country code
parameters.put("dst", "+91*******"); // Receiver's phone number with country code
parameters.put("text", "Hi, text from Plivo"); // Your SMS text message

try {
  // Send the message
  MessageResponse msgResponse = api.sendMessage(parameters);
  // Print the response
  System.out.println(msgResponse);
  // Print the Api ID
  System.out.println("Api ID : " + msgResponse.apiId);
  // Print the Response Message
  System.out.println("Message : " + msgResponse.message);

  if (msgResponse.serverCode == 202) {
  // Print the Message UUID
  System.out.println("Message UUID : " +   msgResponse.messageUuids.get(0).toString());
  } else {
     System.out.println(msgResponse.error);
         }
        } catch (PlivoException e) {
            System.out.println(e.getLocalizedMessage());
     }

我試圖使用控制台應用程序以及Web應用程序運行此代碼。我得到異常“com.plivo.helper.exception.PlivoException:連接到https://api.plivo.com拒絕”。 我的代碼出了什么問題? 我在這里錯過了什么嗎?

Plivo銷售工程師在這里。

請檢查您的防火牆設置,以確保它不會阻止任何流量。 另外,您使用的是Web代理嗎? 如果是,請確保您的應用程序正在使用此代理來處理連接。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM