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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:14:15+00:00 2026-06-08T05:14:15+00:00

I am trying to send string array from web service to android application using

  • 0

I am trying to send string array from web service to android application using kSOAP2.
Using kSOAP2, I receive an response in Object format at android end. Now i want to convert this object in String Array format so that i can pass this array directly to GridView.

My Web Service Method is as follows:

[WebMethod]
public string[] getit(string status)
{
   string[] result;
   if (status == "blue")
      result = new string[] { "One", "Two", "Three", "Four" };
   else
      result = new string[] { "five", "six", "Seven", "Eight" };
   return result;
}

My Android Code is as follows:

public void call(String status)
{
   try {    
       SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

       request.addProperty("status",status.toString());

       SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
       envelope.dotNet=true;
       envelope.setOutputSoapObject(request);

       HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
       androidHttpTransport.call(SOAP_ACTION, envelope);

       Object result = (Object)envelope.getResponse();

       array1=(String []) result;   //This statement does not work
   } 
}

In android code array1 is globally declared string array. String array1[];
I want to convert Object result to be converted into array1 String array.
Thanks in advance.

  • 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-08T05:14:17+00:00Added an answer on June 8, 2026 at 5:14 am

    first print the “result” object using result.toString()…. and see what it returns and after that it will not directly convert into the string[] first it should convert into the Object[] array… and one by one it will convert into the string[] array… so your code should be like….

    Object[] objArr=(Object[])result;

    String[] strArr=new String[objArr.length];

    for(int i=0;i<=objArr.length;i++)

    {

      strArr[i]=objArr[i].toString();
    

    }

    Thats how u can do it….

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

Sidebar

Related Questions

I am trying to send a byte[] from a client to a web service.
I am trying to receive a post array send from the view page by
I am trying to send JSON data from a form using the XMLHttpRequest object.
I am trying to send a simple string from One viewcontroller to another viewcontroller
am trying send an array to php file using $_POST ,still always getting an
I am trying to send an image from a Java desktop application to a
I am trying to convert an object to byte array & send it through
I've got problem sending an array of string as parameter to a web service
I'm trying to send a simple POST request to a REST web service and
Trying to send an array from: <select name='galaddvenn[]' class='sel_add vl hidden' multiple='multiple'> <option value='53'>name1</option>

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.