精华内容
下载资源
问答
  • 验证码:找回密码,登陆,绑定银行卡是点击获取验证码,由系统发送一条验证信息给当前手机,求各位大牛指教
  • 直接上工具类 ...import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; impor...

    直接上工具类

    package com.okrsoa.commons.util;
    
    import java.io.BufferedReader;
    import java.io.DataOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.UnsupportedEncodingException;
    import java.net.HttpURLConnection;
    import java.net.URL;
    import java.net.URLEncoder;
    import java.util.HashMap;
    import java.util.Map;
    
    import com.alibaba.fastjson.JSONObject;
     
    
    /**
     * @describe 聚合短信发送 
     */
    public class JuheSmsUtil {
    	
    	public static final String DEF_CHATSET = "UTF-8";
    	public static final int DEF_CONN_TIMEOUT = 30000;
    	public static final int DEF_READ_TIMEOUT = 30000;
    	public static String userAgent =  "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/537.36";
    	
    	//配置您申请的KEY
    	public static final String APPKEY = "";
    	
     
    	 
    	//发送短信
    	public static void sendSms(String mobile, String name,String oaurl){
    		 
    		String result = null;
    		String url = "http://v.juhe.cn/sms/send";//请求接口地址
    		
    		Map<String,String> params = new HashMap();//请求参数
    		
    		params.put("mobile", mobile);//接收短信的用户手机号码
    		params.put("tpl_id", "197394");//您申请的短信模板ID,请参考个人中心短信模板设置
    		params.put("tpl_value", "#OA_NAME#=" + name+"&#OA_URL#=" + oaurl);//你设置的模板变量URLDecoder.decode(code, "UTF-8");(页面encodeURI(encodeURI(code)));
    		//变量名和变量值对。如果你的变量名或者变量值中带有#&=中的任意一个特殊符号,请先分别进行urlencode编码后再传递,<a href="http://www.juhe.cn/news/index/id/50" target="_blank">详细说明></a>
    		params.put("key", APPKEY);//应用APPKEY
    		params.put("dtype", "");//返回数据的格式,xml或json,默认json
    		
    		try {
                result =net(url, params, "GET");
                JSONObject object = JSONObject.parseObject(result);
                if(object.getInteger("error_code")==0){
                    System.out.println(object.get("result"));
                }else{
                    System.out.println(object.get("error_code")+":"+object.get("reason"));
                }
            } catch (Exception e) {
            	 
                e.printStackTrace();
            }
    	}
    	
    	/**
    	 * 
    	 * @param strUrl 请求地址
    	 * @param params 请求参数
    	 * @param method 请求方法
    	 * @return
    	 * @throws Exception
    	 */
    	public static String net(String strUrl, Map<String,String> params, String method) throws Exception{
    		
    		HttpURLConnection conn = null;
    		BufferedReader reader = null;
    		String rs = null;
    		try {
    			StringBuffer sb = new StringBuffer();
    			if(method==null || method.equals("GET")){
    				strUrl = strUrl+"?"+urlencode(params);
    			}
    			URL url = new URL(strUrl);
    			conn = (HttpURLConnection) url.openConnection();
    			if(method==null || method.equals("GET")){
    				conn.setRequestMethod("GET");
    			}else{
    				conn.setRequestMethod("POST");
    				conn.setDoOutput(true);
    			}
    			conn.setRequestProperty("User-agent", userAgent);
    			conn.setUseCaches(false);
    			conn.setConnectTimeout(DEF_CONN_TIMEOUT);
    			conn.setReadTimeout(DEF_READ_TIMEOUT);
    			conn.setInstanceFollowRedirects(false);
    			conn.connect();
    			if (params!= null && method.equals("POST")) {
    				try {
    					DataOutputStream out = new DataOutputStream(conn.getOutputStream());
    					out.writeBytes(urlencode(params));
    				} catch (Exception e) {
    					e.printStackTrace();
    				}
    			}
    			InputStream is = conn.getInputStream();
    			reader = new BufferedReader(new InputStreamReader(is, DEF_CHATSET));
    			String strRead = null;
    			while ((strRead = reader.readLine()) != null) {
    				sb.append(strRead);
    			}
    			rs = sb.toString();
    		} catch (IOException e) {
    			e.printStackTrace();
    		} finally {
    			if (reader != null) {
    				reader.close();
    			}
    			if (conn != null) {
    				conn.disconnect();
    			}
    		}
    		return rs;
    		
    	}
    	
    	//将map型转为请求参数型
    		public static String urlencode(Map<String,String> data) {
    			StringBuilder sb = new StringBuilder();
    			for (Map.Entry i : data.entrySet()) {
    				try {
    					sb.append(i.getKey()).append("=").append(URLEncoder.encode(i.getValue()+"","UTF-8")).append("&");
    				} catch (UnsupportedEncodingException e) {
    					e.printStackTrace();
    				}
    			}
    			return sb.toString();
    		}
    }
    
    
    展开全文
  • package com.shopping.utils; import ... import org.springframework.stereotype.Component; import java.io.*; import java.net.HttpURLConnection; import java.net.URL; import ja...
    package com.shopping.utils;
    import com.alibaba.fastjson.JSONObject;
    import org.springframework.stereotype.Component;
    import java.io.*;
    import java.net.HttpURLConnection;
    import java.net.URL;
    import java.net.URLEncoder;
    import java.util.HashMap;
    import java.util.Map;
    /**
     * Author:
     * Date:
     * Description:<描述>
     */
    @Component
    public class smsUtil {
        /**
         * 短信API服务调用示例代码 - 聚合数据
         * 在线接口文档:http://www.juhe.cn/docs/54
         **/
        public static final String DEF_CHATSET = "UTF-8";
        public static final int DEF_CONN_TIMEOUT = 30000;
        public static final int DEF_READ_TIMEOUT = 30000;
        public static String userAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:59.0) Gecko/20100101 Firefox/59.0";
    
        //配置您申请的KEY
        public static final String APPKEY = "";
    
        //1.屏蔽词检查测
        public static void getRequest1() {
            String result = null;
            String url = "http://v.juhe.cn/sms/send";//请求接口地址
            Map params = new HashMap();//请求参数
            params.put("word", "");//需要检测的短信内容,需要UTF8 URLENCODE
            params.put("key", APPKEY);//应用APPKEY(应用详细页查询)
    
            try {
                result = net(url, params, "GET");
                JSONObject object = JSONObject.parseObject(result);
                if (object.getInteger("error_code") == 0) {
                    System.out.println(object.get("result"));
                } else {
                    System.out.println(object.get("error_code") + ":" + object.get("reason"));
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    
        //2.发送短信
        public static void sendSms() {
            String result = null;
            String url = "http://v.juhe.cn/sms/send";//请求接口地址
            Map params = new HashMap();//请求参数
            params.put("mobile", "");//接收短信的手机号码
            params.put("tpl_id", "");//短信模板ID,请参考个人中心短信模板设置
    
            params.put("tpl_value", "");//变量名和变量值对。如果你的变量名或者变量值中带有#&=中的任意一个特殊符号,请先分别进行urlencode编码后再传递,<a href="http://www.juhe.cn/news/index/id/50" target="_blank">详细说明></a>
            params.put("key", APPKEY);//应用APPKEY(应用详细页查询)
            params.put("dtype", "json");//返回数据的格式,xml或json,默认json
    
            try {
                result = net(url, params, "GET");
                JSONObject object = JSONObject.parseObject(result);
                if (object.getInteger("error_code") == 0) {
                    System.out.println(object.get("result"));
                } else {
                    System.out.println(object.get("error_code") + ":" + object.get("reason"));
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    
    
        /**
         * @param strUrl 请求地址
         * @param params 请求参数
         * @param method 请求方法
         * @return 网络请求字符串
         * @throws Exception
         */
        public static String net(String strUrl, Map params, String method) throws Exception {
            HttpURLConnection conn = null;
            BufferedReader reader = null;
            String rs = null;
            try {
                StringBuffer sb = new StringBuffer();
                if (method == null || method.equals("GET")) {
                    strUrl = strUrl + "?" + urlencode(params);
                }
                URL url = new URL(strUrl);
                conn = (HttpURLConnection) url.openConnection();
                if (method == null || method.equals("GET")) {
                    conn.setRequestMethod("GET");
                } else {
                    conn.setRequestMethod("POST");
                    conn.setDoOutput(true);
                }
                conn.setRequestProperty("User-agent", userAgent);
                conn.setUseCaches(false);
                conn.setConnectTimeout(DEF_CONN_TIMEOUT);
                conn.setReadTimeout(DEF_READ_TIMEOUT);
                conn.setInstanceFollowRedirects(false);
                conn.connect();
                if (params != null && method.equals("POST")) {
                    try {
                        DataOutputStream out = new DataOutputStream(conn.getOutputStream());
                        out.writeBytes(urlencode(params));
                    } catch (Exception e) {
                        // TODO: handle exception
                    }
                }
                InputStream is = conn.getInputStream();
                reader = new BufferedReader(new InputStreamReader(is, DEF_CHATSET));
                String strRead = null;
                while ((strRead = reader.readLine()) != null) {
                    sb.append(strRead);
                }
                rs = sb.toString();
            } catch (IOException e) {
                e.printStackTrace();
            } finally {
                if (reader != null) {
                    reader.close();
                }
                if (conn != null) {
                    conn.disconnect();
                }
            }
            return rs;
        }
    
        //将map型转为请求参数型
        public static String urlencode(Map<String, Object> data) {
            StringBuilder sb = new StringBuilder();
            for (Map.Entry i : data.entrySet()) {
                try {
                    sb.append(i.getKey()).append("=").append(URLEncoder.encode(i.getValue() + "", "UTF-8")).append("&");
                } catch (UnsupportedEncodingException e) {
                    e.printStackTrace();
                }
            }
            return sb.toString();
        }
    }
    
    展开全文
  • 发现本地能发送短信,服务器却超时   5.0解决方法。。。由于服务器和本地的环境不同。。检查端口是否开放权限 最重要的….将ip从沙箱设置为app… SERVER_IP = "app.cloopen.com" ; 6.0 clean ...
    1. 先看看错误日志

    2019-01-11 09:21:32,242 INFO [pool-3-thread-1] com.ejavashop.core.sms.xfbsms.utils.LoggerUtil.info(45) -- Fri Jan 11 09:21:32 CST 2019 sendTemplateSMS url = https://sandboxapp.cloopen.com:8883/2013-12-26/Accounts/aaf98f8952f7367a01530c5dd33626c6/SMS/TemplateSMS?sig=7939BE20B60257805AF0B6A99B28ED38

     2019-01-11 09:21:32,243 INFO [pool-3-thread-1] com.ejavashop.core.sms.xfbsms.utils.LoggerUtil.info(45) -- Fri Jan 11 09:21:32 CST 2019 sendTemplateSMS Request body =  {"appId":"8aaf07085e0e36d0015e279952c20746","to":"13152541141","templateId":"259015","datas":["您好,您已成功注册,您的验证码是613957【广东禧越科技】","10"]}

     2019-01-11 09:21:32,243 DEBUG [pool-3-thread-1] org.apache.http.impl.conn.BasicClientConnectionManager.getConnection(160) -- Get connection for route {s}->https://sandboxapp.cloopen.com:8883

     2019-01-11 09:21:32,278 DEBUG [pool-3-thread-1] org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(174) -- Connecting to sandboxapp.cloopen.com:8883

     

     

    2019-01-11 09:21:47,870 DEBUG [Timer-0] org.apache.http.impl.conn.LoggingManagedHttpClientConnection.shutdown(87) -- http-outgoing-85: Shutdown connection

     2019-01-11 09:21:47,871 DEBUG [Timer-0] org.apache.http.impl.execchain.ConnectionHolder.abortConnection(128) -- Connection discarded

     2019-01-11 09:21:47,871 DEBUG [Timer-0] org.apache.http.impl.conn.LoggingManagedHttpClientConnection.close(79) -- http-outgoing-85: Close connection

     2019-01-11 09:21:47,871 DEBUG [Timer-0] org.apache.http.impl.conn.PoolingHttpClientConnectionManager.releaseConnection(320) -- Connection released: [id: 85][route: {}->http://183.232.34.84:8080][total kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 20]

     org.apache.http.conn.ConnectTimeoutException: Connect to 183.232.34.84:8080 [/183.232.34.84] failed: Connection timed out

    at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:149)

    at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)

    at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)

    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)

    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)

    at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)

    at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)

    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)

    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)

    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)

    at com.ejavashop.core.HttpClientUtil.sendGet(HttpClientUtil.java:36)

    at com.ejavashop.web.job.IndexCacheTimerTask.run(IndexCacheTimerTask.java:40)

    at java.util.TimerThread.mainLoop(Timer.java:555)

    at java.util.TimerThread.run(Timer.java:505)

    Caused by: java.net.ConnectException: Connection timed out

    at java.net.PlainSocketImpl.socketConnect(Native Method)

    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)

    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)

    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)

    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

    at java.net.Socket.connect(Socket.java:589)

    at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:74)

    at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134)

    ... 13 more

    2019-01-11 09:21:47,871 DEBUG [Timer-0] org.apache.http.impl.conn.PoolingHttpClientConnectionManager.shutdown(388) -- Connection manager is shutting down

     2019-01-11 09:21:47,872 DEBUG [Timer-0] org.apache.http.impl.conn.PoolingHttpClientConnectionManager.shutdown(394) -- Connection manager shut down

     2019-01-11 09:21:47,872 INFO [Timer-0] com.ejavashop.web.job.IndexCacheTimerTask.run(46) -- ----------------定时器执行结束-----------------------

     2019-01-11 09:21:56,433 DEBUG [Timer-1] org.apache.http.impl.conn.LoggingManagedHttpClientConnection.shutdown(87) -- http-outgoing-85: Shutdown connection

     2019-01-11 09:21:56,433 DEBUG [Timer-1] org.apache.http.impl.execchain.ConnectionHolder.abortConnection(128) -- Connection discarded

     2019-01-11 09:21:56,434 DEBUG [Timer-1] org.apache.http.impl.conn.LoggingManagedHttpClientConnection.close(79) -- http-outgoing-85: Close connection

     2019-01-11 09:21:56,434 DEBUG [Timer-1] org.apache.http.impl.conn.PoolingHttpClientConnectionManager.releaseConnection(320) -- Connection released: [id: 85][route: {}->http://183.232.34.84:8080][total kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 20]

     org.apache.http.conn.ConnectTimeoutException: Connect to 183.232.34.84:8080 [/183.232.34.84] failed: Connection timed out

    at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:149)

    at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)

    at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)

    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)

    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)

    at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)

    at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)

    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)

    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)

    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)

    at com.ejavashop.core.HttpClientUtil.sendGet(HttpClientUtil.java:36)

    at com.ejavashop.web.job.IndexCacheTimerTask.run(IndexCacheTimerTask.java:40)

    at java.util.TimerThread.mainLoop(Timer.java:555)

    at java.util.TimerThread.run(Timer.java:505)

    Caused by: java.net.ConnectException: Connection timed out

    at java.net.PlainSocketImpl.socketConnect(Native Method)

    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)

    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)

    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)

    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

    at java.net.Socket.connect(Socket.java:589)

    at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:74)

    at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134)

    ... 13 more

    2019-01-11 09:21:56,434 DEBUG [Timer-1] org.apache.http.impl.conn.PoolingHttpClientConnectionManager.shutdown(388) -- Connection manager is shutting down

     2019-01-11 09:21:56,434 DEBUG [Timer-1] org.apache.http.impl.conn.PoolingHttpClientConnectionManager.shutdown(394) -- Connection manager shut down

     2019-01-11 09:21:56,434 INFO [Timer-1] com.ejavashop.web.job.IndexCacheTimerTask.run(46) -- ----------------定时器执行结束-----------------------

    2.0

    首先从main方法开始。。。图中箭头从左到右依次为 手机号,模板号,验证码。。有效期

    3.0 检查一些参数

     

    4.执行main方法

     

    发现本地能发送短信,服务器却超时

     

    5.0解决方法。。。由于服务器和本地的环境不同。。检查端口是否开放权限

    最重要的….将ip从沙箱设置为app…    SERVER_IP = "app.cloopen.com";

    6.0 clean install package 上传服务器

    完成

    展开全文
  • java编写的调用国内第三方平台发送短信的例子及相关文档
  • 1.第三方短信平台API 使用Java发送手机短信,一般要通过第三方的短信平台完成,所以我们可以先选择一家短信平台,注册用户。这里我们选择中国建网完成短信发送。 1.先到中国网建...

    1.第三方短信平台API
    使用Java发送手机短信,一般要通过第三方的短信平台完成,所以我们可以先选择一家短信平台,注册用户。这里我们选择中国建网完成短信发送。
    1.先到中国网建(http://sms.webchinese.cn/default.shtml)注册用户,可以获得5条免费短信用于测试,用完了可以继续充值或者打电话申请多几条免费短信(请说明是用于开发测试)。
    2.注册的用户会获得一个密钥,编程时候要用以标识身份。登录后点击“修改短信密钥”可以看到密钥。
    3.做了这些准备工作,如何发送短信呢,短信平台会提供调用方式,在首页点击“短信API接口”,我们可以查看API说明,实际上是通过表单提交的请求来说明各种参数的。
    2.具体实现步骤
    (1)准备所需要的jar包

    <!-- commons-logging.jar -->
    	<dependency>
    		<groupId>commons-logging</groupId>
    		<artifactId>commons-logging</artifactId>
    		<version>1.2</version>
    	</dependency>
    	<!-- commons-httpclient.jar -->
    	<dependency>
    		<groupId>commons-httpclient</groupId>
    		<artifactId>commons-httpclient</artifactId>
    		<version>3.1</version>
    	</dependency>
    	<!-- commons-codec.jar -->
    	<dependency>
    		<groupId>commons-codec</groupId>
    		<artifactId>commons-codec</artifactId>
    		<version>1.10</version>
    	</dependency>
    

    (2)封装SmsSender工具类
    使用到“commons-httpclient.jar”用来向第三方平台发送POST请求。

    public class SmsSender {
    	public int sendSms(String phoneNr, String message) throws HttpException, IOException {
    		//使用commons-httpclient向第三方平台包发送POST请求
    		HttpClient client = new HttpClient();
    		PostMethod post = new PostMethod("http://utf8.sms.webchinese.cn");
    		post.addRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
    		NameValuePair[] data = { 
    				new NameValuePair("Uid", "xxxxxxxxxx"), 		 	//注册用户名,请修改
    				new NameValuePair("Key", "xxxxxxxxxx"), 			//密钥,请求修改
    				new NameValuePair("smsMob", phoneNr), 				//手机号码
    				new NameValuePair("smsText", message) };			//短信内容
    		post.setRequestBody(data);
    		client.executeMethod(post);					//发送请求
    		int statusCode = post.getStatusCode();
    		System.out.println("statusCode:" + statusCode);
    		if(statusCode!=200){
    			throw new RuntimeException("短信平台发送不成功,状态吗:"+statusCode);
    		}
    		//返回的短信发送状态信息,含义详见中国网建的API说明
    		String result = new String(post.getResponseBodyAsString().getBytes("utf-8"));
    		System.out.println(result); // 打印返回消息状态
    		return Integer.parseInt(result);
    	}
    }
    

    (3)制作一个简单界面测试短信发送
    JSP页面:

    <h3>短信发送测试</h3>
    	<form action="sms" method="post">
    	手机号码:<input name="phoneNr" /><br/>
    	短信消息:<input name="message" /> <button>发送</button>
    	</form>
    	<label style="color:red">${error}</label>
    Servlet部分:
    @WebServlet("/sms")
    public class SmsServlet extends HttpServlet {
    	@Override
    	protected void doPost(HttpServletRequest req, HttpServletResponse resp) 
    throws ServletException, IOException {
    		req.setCharacterEncoding("UTF-8");
    		String phoneNr = req.getParameter("phoneNr");
    		String message = req.getParameter("message");
    		SmsSender smsSender = new SmsSender();
    		int code = smsSender.sendSms(phoneNr, message);
    		if(code == 1){
    			resp.sendRedirect(req.getContextPath()+"/success.jsp");
    		}else{
    			req.setAttribute("error", "短信发送不成功,错误编号:"+code);
    			req.getRequestDispatcher("test.jsp").forward(req, resp);
    		}
    	}
    }
    

    运行效果如下图所示。
    在这里插入图片描述
    在这里插入图片描述

    展开全文
  • 1. 概述在实际开发过程中,我们经常需要调用对方提供的接口...在Java项目中调用第三方接口的方式有:①通过JDK网络类Java.net.HttpURLConnection;②通过common封装好的HttpClient;③通过Apache封装好的CloseableHt...
  • 概述 在实际开发过程中,我们经常需要调用对方提供的接口或测试自己写的接口是否合适。很多项目都会封装规定好本身项目的接口规范,所以大多数需要去调用对方提供的接口或第三方接口(短信、天气...Java调用第三方http.
  • 1. 概述在实际开发过程中,我们经常需要调用对方提供的接口...在Java项目中调用第三方接口的方式有:①通过JDK网络类Java.net.HttpURLConnection;②通过common封装好的HttpClient;③通过Apache封装好的CloseableHt...
  • 在项目发送短信方案中通过第三方提供的http链接方式来发送短信,采用了java sockt方案来解决,但是在应用过程中出现了一个奇怪的问题,加以记录: 代码如下: import java.io.BufferedReader; import java.io....
  • 1. 概述在实际开发过程中,我们经常需要调用对方提供的接口...在Java项目中调用第三方接口的方式有:①通过JDK网络类Java.net.HttpURLConnection;②通过common封装好的HttpClient;③通过Apache封装好的CloseableHt...
  • Java调用第三方接口(http总结)

    千次阅读 2019-09-01 12:32:57
    业务需求: 一般情况下都是 后端提供接口,前端调用,解决需求,但是有的时候为了方便,复用别人的接口(网上的,公共的第三方接口(短信、天气等))...在Java项目中调用第三方接口的方式有: ①通过JDK网络类Java....
  • Java代码调用第三方接口发送短信

    千次阅读 2018-01-22 11:33:17
    添加依赖:  com.sun.mail    javax.mail   public class Message...//短信服务提供商。这个就百度吧,很多,真的很多。我随便找的一家提供商。  private static String Url = "http://106.ihu
  • 本实例调用互亿无线触发短信接口,采用commons-httpclient-3.1.jar及dom4j-1.6.1.jar俩个jar包实现,可根据个人需求更改调用接口 //接口类型:互亿无线触发短信接口,支持发送验证码短信、订单通知短信等。 //...
  • java调用webservice调用短信接口发送短信 本人现在有个功能是发送短信验证码,第三方只给了一个url,领导说利用web service调用短信接口就好了 求助一下 具体实现的思路和技术点
  • 使用 Java 调用阿里云短信服务使用 Java 调用...不过通常情况下,短信服务都是外包给第三方公司的,接下来向大家分享如何使用阿里的短信服务。 登录阿里云申请短信服务 首先我们登陆阿里云官网,搜索短信服务,注册并开
  • 近来由于项目需要,需要用到手机短信验证码的功能,其中最主要的是用到了第三方提供的短信平台接口WebService客户端接口,下面我把我在项目中用到的记录一下,以便给大家提供个思路,由于本人的文采有限,还请大家...
  • java调用webservice接口发送短信

    千次阅读 2017-06-14 10:53:23
    近来由于项目需要,需要用到手机短信验证码的功能,其中最主要的是用到了第三方提供的短信平台接口WebService客户端接口,下面我把我在项目中用到的记录一下,以便给大家提供个思路,由于本人的文采有限,还请大家...
  • 不过通常情况下,短信服务都是外包给第三方公司的,接下来向大家分享如何使用阿里的短信服务。 登录阿里云申请短信服务 首先我们登陆阿里云官网,搜索短信服务,注册并开通授权。 这里为了方便小伙伴快速申请也可以...
  • 一、 action :import内容 没用的可以去掉import java.util.ArrayList;import java.util.List;import java.util.Map;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;...

空空如也

空空如也

1 2 3 4 5 ... 10
收藏数 185
精华内容 74
关键字:

java调用第三方短信

java 订阅