Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7852389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:24:26+00:00 2026-06-02T19:24:26+00:00

I am using soap webservice and I have got the proper response, now i

  • 0

I am using soap webservice and I have got the proper response, now i want to parse the response I have written code for that but I am not getting output, Can someone help me ?

My main class is

public class Mylearning extends ListActivity {
    //ArrayList<cat> list = null;
    private static final String SOAP_ACTION="http://yyy.mobi/GetLearningPortalsList";
    private static final String METHOD_NAME ="GetLearningPortalsList";
    private static final String NAMESPACE ="http://yyy.mobi/";
    private static final String URL = "http://webservices.yyy.mobi/MobileLMSServices.asmx";
    private Bundle bundleResult = new Bundle();
    private JSONObject JSONObj;
    private JSONArray JSONArr;
    //private ArrayList<HashMap<String, Object>> myList;
    SoapObject request;
    TextView tv;
    TextView tv1;
    TextView tv2;               
    ListView mainListView;
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.mylearning);

        //mainListView = (ListView) findViewById(R.id.main_listview);
        request = new SoapObject(NAMESPACE, METHOD_NAME);
        request.addProperty("SiteURL","http://www.yyy.mobi/");
        request.addProperty("PageID","1");
        request.addProperty("SearchText","");

        ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();   

        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        SoapObject result = null;
        envelope.setOutputSoapObject(request);
        AndroidHttpTransport sab = new AndroidHttpTransport(URL);
        sab.debug = true;
        try {
            sab.call(SOAP_ACTION, envelope);
            if (envelope.getResponse() != null) {
                result = (SoapObject) envelope.bodyIn;
                String[] values = new String[result.getPropertyCount()];
                int j = result.getPropertyCount();
                String repons=result.toString();
            //  Log.d("result",repons.toString());
                Document doc = XMLfunctions.XMLfromString(repons);
                int numResults = XMLfunctions.numResults(doc);

                if((numResults <= 0)){
                    Toast.makeText(Mylearning.this, "Geen resultaten gevonden", Toast.LENGTH_LONG).show();  
                    finish();
                }

                 NodeList nodes = doc.getElementsByTagName("result");
                for (int i = 0; i < nodes.getLength(); i++) {                           
                    HashMap<String, String> map = new HashMap<String, String>();
                    Element e = (Element)nodes.item(i);
                    map.put("Course", XMLfunctions.getValue(e, "Course"));
                    map.put("Description", "Description:" + XMLfunctions.getValue(e, "Description"));
                    map.put("icon", "icon: " + XMLfunctions.getValue(e, "icon"));
                    mylist.add(map);            
                }

                ListAdapter adapter = new SimpleAdapter(this, mylist , R.layout.rowmylearning, 
                        new String[] { "Course", "Description","icon" }, 
                        new int[] { R.id.txt1, R.id.txt2,R.id.img1 });

                setListAdapter(adapter);
                final ListView lv = getListView();

                lv.setTextFilterEnabled(true);  
                lv.setOnItemClickListener(new OnItemClickListener() {
                    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {              
                        @SuppressWarnings("unchecked")
                        HashMap<String, String> o = (HashMap<String, String>) lv.getItemAtPosition(position);                   
                        Toast.makeText(Mylearning.this, "Course '" + o.get("Course") + "' was clicked.", Toast.LENGTH_LONG).show(); 

                    }
                });

            }
        }

                catch (Exception e) {
                    e.printStackTrace();
                }

            }
}

My XMLFunction class is

public class XMLfunctions {

    public final static Document XMLfromString(String repons){

        Document doc = null;

        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        try {
            DocumentBuilder db = dbf.newDocumentBuilder();
            InputSource is = new InputSource();
            is.setCharacterStream(new StringReader(repons));
            Log.d("message",repons.toString());
            doc = db.parse(is);
        } catch (ParserConfigurationException e) {
            System.out.println("XML parse error: " + e.getMessage());
            return null;
        } catch (SAXException e) {
            System.out.println("Wrong XML file structure: " + e.getMessage());
            return null;
        } catch (IOException e) {
            System.out.println("I/O exeption: " + e.getMessage());
            return null;
        }

        return doc;

    }

    /** Returns element value
      * @param elem element (it is XML tag)
      * @return Element value otherwise empty String
      */
     public final static String getElementValue( Node elem ) {
         Node kid;
         if( elem != null){
             if (elem.hasChildNodes()){
                 for( kid = elem.getFirstChild(); kid != null; kid = kid.getNextSibling() ){
                     if( kid.getNodeType() == Node.TEXT_NODE  ){
                         return kid.getNodeValue();
                     }
                 }
             }
         }
         return "";
     }
    public static int numResults(Document doc){     
        Node results = doc.getDocumentElement();
        int res = -1;

        try{
            res = Integer.valueOf(results.getAttributes().getNamedItem("count").getNodeValue());
        }catch(Exception e ){
            res = -1;
        }

        return res;
    }

public static String getValue(Element item, String str) {       
    NodeList n = item.getElementsByTagName(str);        
    return XMLfunctions.getElementValue(n.item(0));
}

}

My response is as follows

 04-25 11:53:32.806: D/status(2924): GetLearningPortalsListResponse{GetLearningPortalsListResult=anyType{schema=anyType{element=anyType{complexType=anyType{choice=anyType{element=anyType{complexType=anyType{sequence=anyType{element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; }; }; }; element=anyType{complexType=anyType{sequence=anyType{element=anyType{}; }; }; }; }; }; }; }; 
diffgram=anyType
{
NewDataSet=anyType

{
Table=anyType
{
ROWID=1; SiteID=7; PortalName=Pinneast; mSiteURL=http://pinneast.xxx.mobi/; ProtalLogo=/Content/SiteConfiguration/7/MyportalLogo.gif; Description=Pinneast is focused on improving business performance through human capital development and experienced in helping organizations of all sizes and across all industries; 
};

Table=anyType   
{
ROWID=2; SiteID=10; PortalName=Coach Institute; mSiteURL=http://coachinstitute.xxx.mobi/; ProtalLogo=/Content/SiteConfiguration/10/MyportalLogo.gif; Description=The Coaching Institute, where you are learning from someone who “does” and not just someone who “teaches”. We can train you to be a successful coach.; 
}; 

Table=anyType
{
ROWID=3; SiteID=12; PortalName=Ready Courses; mSiteURL=http://readycourses.xxx.mobi/; ProtalLogo=/Content/SiteConfiguration/12/MyportalLogo.gif; Description=When you work with us, you get a professional team of e-learning and corporate training professionals who are passionate about getting the best technology implemented without high costs.; 
}; 

Table=anyType
{
ROWID=4; SiteID=13; PortalName=A Step to Gold; mSiteURL=http://asteptogold.xxx.mobi/; ProtalLogo=/Content/SiteConfiguration/13/MyportalLogo.gif; 
Description=The Ballroom is solely owned and operated by Melanie Dale. It has a 2400 square foot floating floor, and two other teaching studios.; 
}; 


Table=anyType
{ROWID=5; SiteID=14; PortalName=In Sync Training; mSiteURL=http://insynctraining.xxx.mobi/; ProtalLogo=/Content/SiteConfiguration/14/MyportalLogo.gif; 
Description=InSync Training offers a variety of consulting, development and delivery services to support synchronous training initiatives.; 
}; 

Table=anyType
{ROWID=6; SiteID=15; PortalName=Total Motion Release; mSiteURL=http://totalmotionrelease.xxx.mobi/; ProtalLogo=/Content/SiteConfiguration/15/MyportalLogo.gif;
 Description=Two stories emphasize how Tom Dalonzo-Baker discovered Total Motion Release.; }; 

Table=anyType
{ROWID=7; SiteID=16; PortalName=Polaris Consultants; mSiteURL=http://polaris.xxx.mobi/; ProtalLogo=/Content/SiteConfiguration/16/MyportalLogo.gif; 
Description=Founded in 1997, and located adjacent to the Research Triangle Park in North Carolina, Polaris Clinical Research Consultants, Inc.; };

Table=anyType
{ROWID=8; SiteID=17; 
PortalName=Develop Mentor Training; mSiteURL=http://developmentor.xxx.mobi/; ProtalLogo=/Content/SiteConfiguration/17/MyportalLogo.gif; Description=DevelopMentor provides in-depth, hands-on training for experienced developers.; }; 


Table=anyType
{ROWID=9; SiteID=18; PortalName=Cranky Middle Manager; mSiteURL=http://cmm.xxx.mobi/; ProtalLogo=/Content/SiteConfiguration/18/MyportalLogo.gif; 
Description=If you've ever felt like you're trapped between the idiots who make the decisions and the morons who won't do as their told.; };

Table=anyType
{ROWID=10; SiteID=19; 
PortalName=ITPreneurs; mSiteURL=http://itpreneurs.xxx.mobi/; ProtalLogo=/Content/SiteConfiguration/19/MyportalLogo.gif; 
Description=ITpreneurs is the leading training solutions company in the IT management and IT governance best practices domain.;
 }; 
Table1=anyType{TotalRecordsCount=387; }; 
}; 
}; 
}; 
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T19:24:27+00:00Added an answer on June 2, 2026 at 7:24 pm

    do you have count tag in your xml.have you checked?

    because in numResults function.it returns result according to count tag in xml.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a webservice using the PHP SOAP classes. It has functions to
I've got a JAX-WS WebService that is using Spring 3 IOC. I have coded
I'm using JaxWsPortProxyFactoryBean in Spring to connect a SOAP webservice. The problem is that
I have to create a module using c# to consume Zimbra Webservice (soap protocol)
i have webservice that is using .net 2.0 server 2003 32 bit when i
I have an xml from a webservice that I want to store in a
I am using JMeter to load test a SOAP webservice. The webservice exists in
I’m trying to implement a SOAP webservice in Python 2.6 using the suds library.
I'm interfacing to a WCF web service that exposes its method using SOAP, using
I am new to using soap. I have a soap method returning an object.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.