接口
2014-03-29 13:42
274 查看
public static Map<String,String> getMapValue(String url,String method,ArrayList<Map<String,String>> list){ Map<String,String> param=new HashMap<String, String>(); String detail=null; String namespace="http://service.itcs.inhua.com/"; //命名空间 String Soap_Action="http://service.itcs.inhua.com/"+method; //SOAP Action通常为命名空间 + 调用的方法名称。 SoapObject request = new SoapObject(namespace, method); for(int i=0;i<list.size();i++){ try{ for (Map.Entry<String, String> entry:list.get(i).entrySet()) { String key=entry.getKey(); String value=entry.getValue(); request.addProperty(key,value); } }catch(Exception e){ e.printStackTrace(); } } SoapSerializationEnvelope envelope = new SoapSerializationEnvelope (SoapEnvelope.VER11); envelope.bodyOut = request; envelope.dotNet = true; envelope.setOutputSoapObject(request); HttpTransportSE ht = new HttpTransportSE(url); ht.debug = true; try{ ht.call(Soap_Action, envelope); if( envelope.bodyIn!=null){ SoapObject soapObject = (SoapObject) envelope.bodyIn; for(int i=0;i<soapObject.getPropertyCount();i++){ SoapObject soapChilds =(SoapObject) soapObject.getProperty(i); SoapObject soapChil=(SoapObject)soapChilds.getProperty("entry"); param.put("message", ""+soapChil.getPropertyAsString("value")); } detail=soapObject.getProperty(0).toString(); String[] strs=detail.split("entry"); String[] str=strs[2].split("="); String records=str[3].split(";")[0]; param.put("totalRecords", records); } }catch(IOException e){ e.printStackTrace(); }catch(XmlPullParserException e){ e.printStackTrace(); } return param; } public static String getRequestInt(String url,String method,ArrayList<Map<String,Integer>> list){ String detail=null; String namespace="http://service.itcs.inhua.com/"; //命名空间 String Soap_Action="http://service.itcs.inhua.com/"+method; //SOAP Action通常为命名空间 + 调用的方法名称。 SoapObject request = new SoapObject(namespace, method); for(int i=0;i<list.size();i++){ try{ for (Map.Entry<String, Integer> entry:list.get(i).entrySet()) { String key=entry.getKey(); int value=entry.getValue(); request.addProperty(URLEncoder.encode(key, "UTF-8"),value); } }catch(Exception e){ e.printStackTrace(); } } SoapSerializationEnvelope envelope = new SoapSerializationEnvelope (SoapEnvelope.VER11); envelope.bodyOut = request; envelope.dotNet = true; envelope.setOutputSoapObject(request); HttpTransportSE ht = new HttpTransportSE(url); ht.debug = true; try{ ht.call(Soap_Action, envelope); if( envelope.bodyIn!=null){ SoapObject so = (SoapObject) envelope.bodyIn; detail = so.getProperty(0).toString(); } }catch(IOException e){ e.printStackTrace(); }catch(XmlPullParserException e){ e.printStackTrace(); } return detail; }
相关文章推荐
- 中缀表达式转换成后缀表达式以及逆波兰表示法求值
- Android Layout布局
- 6款Java转C#的最佳工具
- 退出所有activity实例
- HDU 1547 搜索
- cocos2d-x 血泪史(1.5) 先从helloworld 切换到menu 吧
- 详细讲解Android对自己的应用代码进行混淆加密防止反编译
- 一些有用的istream功能
- Java与C++ 解题报告
- Using Fancy Box show image list
- 插入操作员跳过空格和换行符
- SqlServer 分页存储过程
- C# public、protected、internal 、private
- java--其他对象(System,Runtime,Date,Calendar,Math)
- cursor的一些用法
- WebAPI返回数据类型解惑【转】
- iframe调用父页面的方法
- 2013阿里巴巴实习生笔试
- Android加载器LoaderManager.LoaderCallbacks的使用
- iostream库是相当复杂的