A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

正哥敲代码 发表于 2016-7-29 19:22
看到了很好的东西谢谢了

好好好好好好好好好
回复 使用道具 举报
好好好好好好好好好好好好好
回复 使用道具 举报
回复 使用道具 举报
下载看看看。
回复 使用道具 举报
回复 使用道具 举报
这个是全部的公开视频吗
回复 使用道具 举报
回复 使用道具 举报
安啦啦啦 来自手机 初级黑马 2018-1-2 19:43:36
428#
元旦到,愿你在新的一年里,快乐自动送上门,金钱开口就会有,好运出门就遇到,健康时时不离身,幸福随手即可得。
回复 使用道具 举报
感谢楼主分享
回复 使用道具 举报
dddddddddddddddddddddd
回复 使用道具 举报
回复 使用道具 举报
感谢大佬
回复 使用道具 举报
新人请多多关照
回复 使用道具 举报
回复 使用道具 举报
来点黑马币
回复 使用道具 举报
什么东东
回复 使用道具 举报
66666666666666666
回复 使用道具 举报
askar 初级黑马 2017-11-18 18:58:50
418#
听说回帖还有黑马币奖励!!!

回复 使用道具 举报
603291569 来自手机 初级黑马 2017-11-18 09:27:24
417#
WebService 实现手机号码归属地查询
就业指导-何家旺老师 2013-8-20 22:43:41
如题,实现手机号码归属地查询!
public class Mobile {
        /**
         * 获得soap请求
         * @param mobileCode
         * @return
         */
        private static String getSoapRequest(String mobileCode){
                StringBuilder sb = new StringBuilder();
                sb.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>"+"\n"
                                +"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""+" "
                                +"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""+" "
                                +"xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"+"\n"
                                +"<soap:Body>"+"\n"
                                +"<getMobileCodeInfo"+" "+"xmlns=\"http://WebXml.com.cn/\">"+"\n"
                                +"<mobileCode>"+mobileCode+"</mobileCode>"+"\n"
                                +"<userID></userID>"+"\n"
                                +"</getMobileCodeInfo>"+"\n"
                                +"</soap:Body>"+"\n"
                                +"</soap:Envelope>"
                                );
                return sb.toString();
        }
        /**
         * 发送soap请求到服务器,并接受返回数据
         * @param mobileCode
         * @return
         */
        private static InputStream getSoapInputStream(String mobileCode){
                try {
                        String soap = getSoapRequest(mobileCode);
                        if(soap == null)
                                return null;
                        URL url = new URL("http://www.webxml.com.cn/WebServices/MobileCodeWS.asmx");
                        URLConnection conn = url.openConnection();
                        conn.setUseCaches(false);
                        conn.setDoInput(true);
                        conn.setDoOutput(true);
                        
                        conn.setRequestProperty("Content-Type", "text/xml; charset=utf-8");
                        conn.setRequestProperty("Content-Length", Integer.toString(soap.length()));
                        conn.setRequestProperty("SOAPAction", "http://WebXml.com.cn/getMobileCodeInfo");
                        
                        OutputStream os = conn.getOutputStream();
                        OutputStreamWriter osw = new OutputStreamWriter(os,"UTF-8");
                        osw.write(soap);
                        osw.flush();
                        osw.close();
                        
                        InputStream is = conn.getInputStream();
                        return is;
                } catch (Exception e) {
                        e.printStackTrace();
                        return null;
                }
        }
        
本帖隐藏的内容

        public static String getMobileNoTrack(String mobileCode){
                try {
                        Document document = null;
                        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
                        dbf.setNamespaceAware(true);
                        InputStream is = getSoapInputStream(mobileCode);
                        DocumentBuilder db = dbf.newDocumentBuilder();
                        document = db.parse(is);
                        NodeList nl = document.getElementsByTagName("getMobileCodeInfoResult");
                        StringBuffer sb = new StringBuffer();
                        for(int i=0;i<nl.getLength();i++){
                                Node n = nl.item(i);
                                if(n.getFirstChild().getNodeValue().equals("手机号码错误")){
                                        sb = new StringBuffer("#");
                                        System.out.println("手机号码输入有误");
                                        break;
                                }
                                sb.append(n.getFirstChild().getNodeValue()+"\n");
                        }
                        is.close();
                        return sb.toString();
                        
                } catch (Exception e) {
                        e.printStackTrace();
                        return null;
                }
        }
}
回复 使用道具 举报
大保健大宝剑
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马