Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/331.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Plivo SMS未被发送,Java中出现错误_Java_Plivo - Fatal编程技术网

Plivo SMS未被发送,Java中出现错误

Plivo SMS未被发送,Java中出现错误,java,plivo,Java,Plivo,我正在将Plivo SMS API与我的java web应用程序集成。我想通过我的应用程序发送消息。我指的是林克。 下面是代码片段: String authId = "{my Auth_id}"; //Your Authentication ID String authToken = "{my auth Token}"; //Your authentication code RestAPI api = new RestAPI(authId, authToken, "v1"); LinkedHa

我正在将Plivo SMS API与我的java web应用程序集成。我想通过我的应用程序发送消息。我指的是林克。 下面是代码片段:

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());
     }
String authId=“{my Auth_id}”//您的身份验证ID
字符串authToken=“{my auth Token}”//您的身份验证码
RestAPI api=newrestapi(authId,authToken,“v1”);
LinkedHashMap参数=新建LinkedHashMap();
参数。put(“src”,“+44*******”);//发件人的电话号码及国家/地区代码
参数。put(“dst”,“+91*******”);//带国家/地区代码的收件人电话号码
parameters.put(“text”、“Hi,来自Plivo的文本”);//你的短信
试一试{
//发送消息
MessageResponse msgResponse=api.sendMessage(参数);
//打印响应
系统输出打印项次(msgResponse);
//打印Api ID
System.out.println(“Api ID:+msgResponse.apid”);
//打印响应消息
System.out.println(“消息:+msgressponse.Message”);
if(msgResponse.serverCode==202){
//打印消息UUID
System.out.println(“消息UUID:+msgResponse.messageUuids.get(0.toString());
}否则{
System.out.println(msgressponse.error);
}
}捕获(plivoe){
System.out.println(e.getLocalizedMessage());
}

我尝试使用控制台应用程序和web应用程序运行此代码。我收到异常“com.plivo.helper.exception.PlivoException:拒绝连接”。我的代码有什么问题?我有什么遗漏吗

这里是Plivo销售工程师


请检查您的防火墙设置,以确保它不会阻止任何流量。另外,您是否正在使用web代理?如果是,请确保您的应用程序正在使用此代理处理连接。

请检查您的防火墙设置,以确保它不会阻止任何流量。另外,您是否正在使用web代理?如果是,请确保您的应用程序正在使用此代理处理连接。是的,代理设置存在问题,并且以某种方式阻止了与API的连接。我更改了代理设置,它开始工作。谢谢你的帮助!伟大的请将问题标记为已回答。