Click here to Skip to main content
15,901,284 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am able to get a single text response but can't get an array response

XML response from .asmx webservice

XML
<?xml version="1.0" encoding="UTF-8"?>
-<ArrayOfString xmlns="http://tempuri.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<string>RE</string>

<string>Wazir Muhammad</string>

<string>Logistics</string>

<string>AlReem Water Purification</string>

<string>1234567890</string>

<string>3000</string>

<string>Dummy</string>

</ArrayOfString>


Android Side Code
Java
private class getUser extends AsyncTask<String,Void,String>
    {
        String result;
        TextView tv=(TextView) findViewById(R.id.tvEName);

        @Override
        protected String doInBackground(String... params)
        {
            //String value = params[0].toString();

            SoapObject Request=new SoapObject(NAMESPACE,METHOD_NAME);
            Request.addProperty("value","RE");

            SoapSerializationEnvelope soapEnvelope=new  SoapSerializationEnvelope(SoapEnvelope.VER11);
            soapEnvelope.dotNet=true;
            soapEnvelope.setOutputSoapObject(Request);

            AndroidHttpTransport aht=new AndroidHttpTransport(URL);
            try{
                aht.call(SOAP_ACTION, soapEnvelope);
                SoapObject resultString=(SoapObject)soapEnvelope.getResponse();
                result=resultString.toString();
            }
            catch (Exception ex){
                result=ex.toString();
            }
            return result;
        }
        @Override
        protected void onPostExecute(String result) {
            super.onPostExecute(result);
            tv.setText(result);
        }
    }


The response which I get from ksoap in android is

anyType{string=RE;
string=Wazir Muhammad;
string=Logistics;
string=AlReem Water Purification;
string=1234567890;
string=3000;
string=abc;}
Posted

1 solution

 
Share this answer
 
Comments
Member 10528646 13-Dec-15 13:26pm    
I tried all these but am getting the following exception
java.lang.ClassCastException: org.ksoap2.SoapFault cannot be cast to org.ksoap2.serialization.SoapObject
ridoy 13-Dec-15 14:06pm    
check: http://stackoverflow.com/questions/28235457/java-lang-classcastexception-org-ksoap2-soapfault-cannot-be-cast-to-org-ksoap2, http://stackoverflow.com/questions/13113733/android-org-ksoap2-soapfault-cannot-be-cast
Member 10528646 17-Dec-15 10:47am    
can you help me in this
http://www.codeproject.com/Questions/1065029/Bitmap-Image-is-not-showing-in-iageView-android?arn=0
ridoy 17-Dec-15 11:08am    
check that link posted in the answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900