1
public static UserFriendListContainer getFriendList(SoapObject wizardobject)//TESTED
    {
        UserFriendListContainer container= new UserFriendListContainer();


        List<UserFriendListModel> list= new ArrayList();    

        String currobj= wizardobject.getProperty("FriendListResult").toString();

        Log.v("CurrentObjet+++++++",currobj.toString());




        container.setParserResult(currobj);



        SoapObject result = (SoapObject)wizardobject;
        for(int i=0;i<result.getPropertyCount();i++)
        {

                SoapObject object = (SoapObject)wizardobject.getProperty(i);//here it is break

Log.v("result:::::",result.toString());
                Log.v("obj:::::",object.toString());
                Log.v("friendID",object.getProperty("friendid").toString());
                String friendID=object.getProperty("friendid").toString();

                Log.v("friendname",object.getProperty("friendname").toString());
                String friendname=object.getProperty("friendname").toString();

                Log.v("lastaction",object.getProperty("lastaction").toString());
                String lastaction=object.getProperty("lastaction").toString();

                Log.v("friendphoto",object.getProperty("friendphoto").toString());
                String friendphoto=object.getProperty("friendphoto").toString();

                UserFriendListModel model=new UserFriendListModel();
                model.setfriendID(friendID);
                model.setfriendName(friendname);
                model.setfriendPhoto(friendphoto);
                model.setLastAction(lastaction);

                list.add(model);
            }
            container.setList(list);

        return container;
    }

}

-----
<message name="FriendListRequest"/>
<message name="FriendListResponse">
<part name="FriendListResult" type="tns:FirendListArray"/>
</message> 

my xml part from webservice is that one.Im trying to access my friendlist by parsing.I couldnt understand ..when im debugging it broke in "SoapObject object = (SoapObject)wizardobject.getProperty(i)"..I want to know how can i parse one list that i take from webservice??Thank you for your help in advance...

2 Answers 2

1
public static UserFriendListContainer getfriendlist(SoapObject wizardobject) throws XmlPullParserException, IOException {

        UserFriendListContainer container= new UserFriendListContainer();
        UserFriendListModel model = new UserFriendListModel();

         List<UserFriendListModel> list= null;
          list=new ArrayList<UserFriendListModel>();
        Vector vector = (Vector) wizardobject.getProperty("FriendListResult");

          Log.v("vector+++++++",vector.toString());
          System.out.println("vectorsize+++++++"+vector.size());

          int count=vector.size();


          for (int i = 0; i <count; ++i) { 

        SoapObject test=(SoapObject)vector.get(i);


          Log.v("test+++++++",test.toString());  

               Log.v("friendid",test.getProperty("friendid").toString());
                String friendID=test.getProperty("friendid").toString();

                Log.v("friendname",test.getProperty("friendname").toString());
                String friendname=test.getProperty("friendname").toString();

                Log.v("lastaction",test.getProperty("lastaction").toString());
                String lastaction=test.getProperty("lastaction").toString();

                Log.v("friendphoto",test.getProperty("friendphoto").toString());
                String friendphoto=test.getProperty("friendphoto").toString();

                model.setfriendID(friendID);
                model.setfriendName(friendname);
                model.setfriendPhoto(friendphoto);
                model.setLastAction(lastaction);

                list.add(model);
            }
            container.setList(list);
            System.out.println("List==="+list);


         return container;
    }

Hi guys, After so many effort i have found my answer..I can parse my array with above code..Thank u for interest..

Sign up to request clarification or add additional context in comments.

Comments

0

Are you sure that wizardobject.getProperty(i)

returns a SoapObject?? I would try with a String or just debug it without doing the casting and see what kind of object it is.

Check this -> SoapObject documentation

By the way it's handier if you post the error stack trace.

1 Comment

06-03 11:49:17.187: V/RESPONSE OF getFriendList:(275): FriendListResponse{FriendListResult=[FirendList{friendid=1; friendphoto=profile1.jpg; friendname=Onur Enis Bozdemir; lastaction=Giriş Yaptı - (5 dk önce); }, FirendList{friendid=3; friendphoto=profile5.jpg; friendname=test test; lastaction=Giriş Yaptı - (5 dk önce); }]; } 06-03 11:49:31.159: D/SntpClient(58): request time failed: java.net.SocketException: Address family not supported by protocol in my log cat I have these results..I cant take my list

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.