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

The Archive Base Latest Questions

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

I have .net Web Service and I want to use it on android. This

  • 0

I have .net Web Service and I want to use it on android. This web service’s methods return List(Of String) and I didn’t get response on android. What can I do ? Here is the code..

I’m working on it for 3 days and I didn’t find any solution yet.

In short, I need some list from .net web service and add this list’s items to spinner. Please help me.

public class MainActivity extends Activity {

    private Spinner myspinner;
    private static final String METHOD_NAME = "Sektorler";  
    private static final String NAMESPACE = "http://tempuri.org/";  
    private static final String SOAP_ACTION = "http://tempuri.org/Sektorler";
    private static final String URL = "http://www.xxxxxxxxxx.com/webservice1.asmx";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        myspinner = (Spinner) findViewById(R.id.spinner1);
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,R.layout.activity_main , SektorDoldur());
        myspinner.setAdapter(adapter);
    }


    private ArrayList<String> SektorDoldur() {

        ArrayList<String> sektorler = new ArrayList<String>();

        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;     
        envelope.setOutputSoapObject(request);
        HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
        androidHttpTransport.debug = true;

        try {

       androidHttpTransport.call(SOAP_ACTION, envelope);
       SoapObject response = (SoapObject) envelope.getResponse();

       if (response.hasProperty("String")) {

       if (response.getPropertyAsString("String") == null) {
    //do something
       } else {

           for(int i=0;i<response.getPropertyCount();i++){
//             sektorler.add(i, response.getPropertyAsString("String"));
               sektorler.add(response.getPropertyAsString(i));
           }
        }

}

        } catch (Exception e) {

            e.printStackTrace();

        }

        return sektorler;

    }

Also I’m trying this code but it doesn’t work.

public class MainActivity extends Activity {

    private Spinner myspinner;
    private static final String METHOD_NAME = "Sektorler";  
    private static final String NAMESPACE = "http://tempuri.org/";  
    private static final String SOAP_ACTION = "http://tempuri.org/Sektorler";
    private static final String URL = "http://www.xxxxxxxx.com/webservice1.asmx";
    private String[] denemeList;

    private String[] SektorDoldur(){
        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;     
        envelope.setOutputSoapObject(request);
        HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
        androidHttpTransport.debug = true;

        try {

       androidHttpTransport.call(SOAP_ACTION, envelope);
       SoapObject response = (SoapObject) envelope.bodyIn;
       denemeList = new String[response.getPropertyCount()];

       for(int i=0;i<response.getPropertyCount();i++){ 
           denemeList[i] = response.getPropertyAsString(i).toString();
       }      
} 
        catch (Exception e) {           
            e.printStackTrace();
        }
        return denemeList;      
    }


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        SektorDoldur();

        myspinner = (Spinner) findViewById(R.id.spinner1);
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,R.layout.activity_main , denemeList);
        myspinner.setAdapter(adapter);

    }
  • 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-08T18:14:39+00:00Added an answer on June 8, 2026 at 6:14 pm

    I got it !!

    this is false;

    SoapObject response = (SoapObject) envelope.bodyIn;
    

    Lets see this code, it’s true;

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

    Finally there are some trick about it.

    1. First of all delete ksoap2 jar file from your project.
    2. Save it and close Eclipse.
    3. Then copy ksoap2 jar file, go to your workspace folder.
    4. Open your project folder, click “libs” folder and paste it.
    5. Open again Eclipse and Run Project!!

          private Spinner myspinner;
          private static final String METHOD_NAME = "Sektorler";  
          private static final String NAMESPACE = "http://tempuri.org";   
          private static final String SOAP_ACTION = "http://tempuri.org/Sektorler";
          private static final String URL = "http://www.xxxxxxxxxx.com/webservice1.asmx";
          private String[] denemeList;
      
          private void SektorDoldur(){
      
              SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
              SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
              envelope.dotNet = true;     
              envelope.setOutputSoapObject(request);
              HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
              androidHttpTransport.debug = true;
      
              try {
      
             androidHttpTransport.call(SOAP_ACTION, envelope);
             SoapObject response = (SoapObject) envelope.getResponse();
             denemeList = new String[response.getPropertyCount()];
      
            for(int i=0;i<response.getPropertyCount();i++){ 
      
                 denemeList[i] = response.getPropertyAsString(i).toString();
      
            }      
      } 
              catch (Exception e) {           
                  e.printStackTrace();
              }       
          }
      
      
          @Override
          public void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.activity_main);
      
              SektorDoldur();
      
              myspinner = (Spinner) findViewById(R.id.spinner1);
              ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, denemeList);
              adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
              myspinner.setAdapter(adapter);
      
          }
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created Web-Service in asp.net with c# . Now i want to pass
We have build several web service based on .net. Now we want to create
I have an asp.net web service project. This project contains a few classes declared
I have a web service defined in .Net and I want to consume it
I have a ASP.NET web service ( .asmx ) with methods that receives int
I have a .NET Web Service running in VS2005 and a client that consumes
I have a .NET web service (using asmx...have not upgraded to WCF yet) that
I have a .net web application which has a reference to a web service.
i have an ASP.NET web service that returning a custom entity object (Staff): [WebMethod]
I have an ASP.net web service that I'm using for a web application which

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.