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 7712741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:42:28+00:00 2026-06-01T01:42:28+00:00

I have a web method that returns a String[][] and I’m trying to parse

  • 0

I have a web method that returns a String[][] and I’m trying to parse the return in ksoap2 in android. I can’t seem to understand how it is serialized, but all I’m trying to do is to get the return in a String[][] or ArrayList or Vector or any data structure. I’v tried them all and nothing seems to work. Here is my code.

    try 
    {     
        // connect to web service and call getUploadedMonthsYears web method
        request = new SoapObject(NAMESPACE, "getUploadedMonthsYears"); 
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); 
        envelope.setOutputSoapObject(request);
        androidHttpTransport = new AndroidHttpTransport(URL);
        androidHttpTransport.call("http://alfaisaliah.com/getUploadedMonthsYears", envelope);

        // create a serializable object that will hold the array of strings
        ks = (KvmSerializable)envelope.bodyIn;  
        monthsYears = new String[10][10];

        for(int i = 0; i < ks.getPropertyCount(); i++)
        {
            monthsYears[i][i] = ks.getProperty(i).toString();
        }

    } catch (Exception ex) 
    {
        System.out.println(ex.getMessage());
        return;
    }

the getUploadedMonthsYears() web method returns a String[][] as follows

month, year

1, 2011
2, 2011
3, 2011
1, 2012

and so on. thanx

  • 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-01T01:42:29+00:00Added an answer on June 1, 2026 at 1:42 am

    I have a similar web service (Axis2) that returns a matrix of strings:

    getCadenaResponse{return=anyType{array=hola; array=adios; }; return=anyType{array=hello; array=bye; }; return=anyType{array=bonjour; array=au revoir; }; }
    

    It’s an 3×2 matrix of strings. It’s not a valid JSON response so I use some hack to split the response.

    Try this:

    import android.app.Activity;
    import android.os.Bundle;
    import android.widget.TextView;
    import android.util.Log;
    import java.util.ArrayList;
    
    import org.json.JSONArray;
    import org.json.JSONObject;
    
    import org.ksoap2.SoapEnvelope;
    import org.ksoap2.serialization.SoapObject;
    import org.ksoap2.serialization.SoapSerializationEnvelope;
    import org.ksoap2.transport.HttpTransportSE;
    
    public class MainActivity extends Activity {
    
    private String NAMESPACE =  /* YOUR NAMESPACE */
    private String METHOD_NAME = /* YOUR METHOD NAME */
    private String URL = /* YOUR URL */
    private TextView tv;
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        tv = (TextView)findViewById(R.id.tv);
    
        HttpTransportSE transport = new HttpTransportSE(URL);
        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
        SoapSerializationEnvelope envelope =
            new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(request);
    
        ArrayList<ArrayList<String>> matrix = new ArrayList<ArrayList<String>>();
        try {
            transport.call(NAMESPACE + METHOD_NAME, envelope);
            SoapObject response = (SoapObject)envelope.bodyIn;
    
            int cols = response.getPropertyCount();
            ArrayList<String> list = new ArrayList<String>();
            for (int i = 0; i < cols; i++) {
                Object objectResponse = (Object) response.getProperty(i);
                String result = objectResponse.toString();
                String[] array = result.split(";");
                for (int j = 0; j < array.length-1; j++) {
                    String ss = array[j].substring(array[j].indexOf('='), array[j].length());
                    list.add(ss);
                    Log.v("TEST", ss);
                }
                matrix.add(list);
            }
    
            /* Here you have the matrix of strings in 'matrix' */
    
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    }
    

    This works for me, but I think that only works for primitive types included String.
    Hope it helps.

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

Sidebar

Related Questions

I have a Web Service with Just one Web Method that returns a boolean
I have a web service that returns a decimal value into my json string
I have a method that returns MvcHtmlString, so in my unit test I'm trying
I have a web service that returns a raw string of JSON data (sample
I have a web service that contains this method: [WebMethod] public static List<string> GetFileListOnWebServer()
I have a generic method that returns IEnumerable<KeyValuePair<T, string>> but i expect the T
I have a RESTful web service that returns JSON-serialized data. It can successfully serialize
I have a method that takes a System.Web.UI.Page as an input and returns some
I have a web service (ASMX) and in it, a web method that does
I have a problem with a oneway web method that open a moss site

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.