0

I am using KSoap to fetch .net Web service in android. I got the output but i dont know that how to store that result in Array..My code is look like

SoapObject request=new SoapObject(SOAP_NAMESPACE, METHOD_NAME);
    request.addProperty("UId","212");
    request.addProperty("verificationID","123456");
    SoapSerializationEnvelope envelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);
    envelope.dotNet=true;
        envelope.setOutputSoapObject(request);

        //Toast.makeText(this, "Request : "+request.getProperty(0), Toast.LENGTH_LONG).show();
    HttpTransportSE httpTransport=new HttpTransportSE(SOAP_URL);
    Log.v("Done", request.toString());
    try {
        httpTransport.call(SOAP_ACTION, envelope);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (XmlPullParserException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    try {
        SoapObject response = (SoapObject) envelope.getResponse();
        Toast.makeText(this, "Detail : "+response.toString(), Toast.LENGTH_LONG).show();
        Log.v("RESPONSE : ", response.toString());
    } catch (SoapFault e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

I am getting entire result in object response but dont know how to store in array...If anybody knows than please help me.

2 Answers 2

1
List< SoapObject > results = ArrayList< SoapObject >();
... //your code here
results.add(response);

List is store objects like array by link.

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

Comments

0

Use Following code.

SoapObject response = (SoapObject) envelope.getResponse();          

    String ret[] = new String[response.getPropertyCount()];
        for (int i = 0; i < response.getPropertyCount(); ++i) {
            ret[i] = response.getProperty(i).toString();
        }

6 Comments

Lots of thanx bro...You solved my problem..one more issue i am facing...Actually my WS returns two result i.e. ID,Name so can i store into different array by this code...??
Id and Name are combined like " 1 | Name " ?? or they are separate??
returning like this: anytype{id=5; name=akhil; }
you can do simple json parsing for this.
|

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.