如何在android中的java响应解析

时间:2016-11-20 09:30:33

标签: java android soap

SoapObject request = new SoapObject(Constant.NAME_SPACE, Constant.LOGIN_USER_BY_MOBILENUMBER);
request.addProperty("MobileNO", "8130513899");
request.addProperty("UserPassword", "12546");
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(Constant.URL);
androidHttpTransport.debug = true;
androidHttpTransport.call(Constant.SOAP_ACTION_LOGIN_BY_USERMOBILE, envelope);
SoapObject result = (SoapObject) envelope.bodyIn;
SoapObject root = (SoapObject) result.getProperty(1);
SoapObject s_deals = (SoapObject) root.getProperty("LoginUserByMobileNoResult");
for (int i = 0; i < s_deals.getPropertyCount(); i++) {
    SoapObject s_deals_1 = (SoapObject) s_deals.getProperty(i);
    String x = s_deals_1.getProperty("UserEmail").toString();
    String y = s_deals_1.getProperty("UserMobile").toString();
    String z = s_deals_1.getProperty("UserMpin").toString();
}

这是我的代码,我能够获取数据结果,但我必须解析并从响应中获取数据。请告诉我代码中的错误在哪里。

以下是我的回复:

  

LoginUserByMobileNoResponse {LoginUserByMobileNoResult = {&#34;用户ID&#34;:&#34; 2&#34;&#34; UserParentId&#34;:&#34; 1&#34;&#34;用户名&# 34;:&#34; Anilkumar&#34;&#34;的userPassword&#34;:&#34; 12546&#34;&#34; UserMobile&#34;:&#34; 8133513899&#34;&# 34; USEREMAIL&#34;:&#34; anilaasdt87@gmail.com",&#34; UserMpin&#34;:&#34; 7890&#34;&#34; UserBalance&#34;:&#34 ; 20.0000&#34;,&#34; UserResponseMessage&#34;:&#34;有效&#34;}; }

我想获取UserMobile,UserEmail等所有数据..请告诉我如何获取它。

0 个答案:

没有答案