短信接口怎么写

1.手机短信验证码java接口怎么写这个首先你要确定一下短信平台,他们会给你提供短信实现的接口文档 。
比如:public static String doPost(String reqUrl, Map parameters, String recvEncoding) { HttpURLConnection url_con = null; String responseContent = null; try { StringBuffer params = new StringBuffer(); Iterator iter = parameters.entrySet().iterator(); while (iter.hasNext()) { Map.Entry element = (Map.Entry)iter.next(); params.append(element.getKey().toString()); params.append("="); params.append(URLEncoder.encode(element.getValue().toString(), requestEncoding)); params.append("&"); } if (params.length() > 0) { params = params.deleteCharAt(params.length() - 1); } URL url = new URL(reqUrl); url_con = (HttpURLConnection)url.openConnection(); url_con.setRequestMethod("POST"); System.setProperty("sun.net.client.defaultConnectTimeout", String.valueOf(connectTimeOut)); System.setProperty("sun.net.client.defaultReadTimeout", String.valueOf(readTimeOut)); url_con.setDoOutput(true); byte[] b = params.toString().getBytes(); url_con.getOutputStream().write(b, 0, b.length); url_con.getOutputStream().flush(); url_con.getOutputStream().close(); InputStream in = url_con.getInputStream(); BufferedReader rd = new BufferedReader( new InputStreamReader(in, recvEncoding)); String tempLine = rd.readLine(); StringBuffer tempStr = new StringBuffer(); String crlf = System.getProperty("line.separator"); while (tempLine != null) { tempStr.append(tempLine); tempStr.append(crlf); tempLine = rd.readLine(); } responseContent = tempStr.toString(); rd.close(); in.close(); } catch (IOException localIOException) { } finally { if (url_con != null) { url_con.disconnect(); } } return responseContent; } public static String sendTelCode(String mobile,String telcode){ Map map = new HashMap(); map.put("account", "Babo"); map.put("mobile", mobile); map.put("pswd", "D3dddD"); try { map.put("msg", java.net.URLEncoder.encode("您的验证码是"+telcode+",若非本人操作请忽略","utf-8")); } catch (UnsupportedEncodingException e) {// TODO Auto-generated catch block e.printStackTrace(); } String getValue = http://www.xuexi88.com/zhishi/doPost(".cn " ;24 sendXml += " admin " ;25 26 outStream = conn.getOutputStream();27 28 // 准备通过CONN对象写入XML数据 29 BufferedWriter bw = new BufferedWriter( new java.io.OutputStreamWriter(outStream,30 " UTF-16 " ));31 bw.write(sendXml);32 bw.flush();33 bw.close();34 35 // DataOutputStream dataOutStream = new DataOutputStream(outStream);36 // dataOutStream.writeChars(xml);37 // dataOutStream.flush();38 // dataOutStream.close();39 40 41 // 准备通过CONN对象读取返回的XML数据 42 43 inStream = conn.getInputStream();44 StringBuffer returnXml = new StringBuffer( "" );45 BufferedReader rd = new BufferedReader( new InputStreamReader(inStream,46 " UTF-16 " ));47 for (String line = null ; (line = rd.readLine()) != null ;) {48 returnXml.append(line);49 } 50 System.out.println(returnXml.toString());51 rd.close();52 } catch (IOException ex) {53 ex.printStackTrace();54 } finally {55 try {56 if (outStream != null )57 outStream.close();58 if (inStream != null )59 inStream.close();60 if (conn != null )61 conn.disconnect();62 } catch (IOException e) {63 // TODO 自动生成 catch 块 64 e.printStackTrace();65 } 66 } 67 68 } 69 70 } 。
5.有没有代码可以发短信那种接口一段简单的通过短信接口发送短信的代码(本代码己经过验证通过),可以在几分种内快速嵌入到原有系统中实现发短信功能(如网站、OA、ERP等等系统) 己经调用成功的 URL地址 :6630/gb2312/web_api/?x_eid=0&x_uid=10086&x_pwd_md5=6412121cbb2dc2cb9e460cfee7046be2&x_ac=10&x_gate_id=300&x_target_no= 手机号码&x_memo=你好,我在测试程序 。
只需把里面的手机号换为自己的就可以,感兴趣的可以联系QQ:25493611 20729618 。
6.短信接口 如何调用这个是webservice啊,你在你的项目上点击鼠标右键,然后选择添加服务引用-高级-添加web引用,把你的webservice地址写在URL地址栏里,然后按右边的添加引用就OK了 。