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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:30:34+00:00 2026-06-07T00:30:34+00:00

I am learning how to create an android app and webservice using: Eclipse IDE

  • 0

I am learning how to create an android app and webservice using:
Eclipse IDE
ksoap2 version 2.6.5 with dependencies
Visual studio 2010

my method was to follow this great tutorial: http://www.youtube.com/watch?v=v9EowBVgwSo&feature=related

the tutorial works fine with the w3schools test webservice.

I then attempted to write my own webservice and used the helloworld webservice provided in Visual studio to start me off. I ammended my code to point at the new webservice (published on my development laptop) and ran it on my handset in debug mode.

the communication with the webservice is fine when calling the HelloWorld() webservice. it even returns a result from simpleMethod() but it does not include the parameter that I passed it. e.g. when calling simpleMethod, Iam returned the following string: “Hello “

I think this is an issue with the webservice because it works for the w3schools test webservice but I am stuck and would appreciate some help.

my code follows:

Webservice:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace WMCMobileWebService
{
    /// <summary>
    /// Summary description for Service1
    /// </summary>
    [WebService(Namespace = "http://testuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    [System.Web.Script.Services.ScriptService]
    public class Service1 : System.Web.Services.WebService
    {

        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }

        [WebMethod]
        public string simpleMethod(String srt)
        {
            return "Hello " + srt;
        }
    }
}

Android app MainActivity:

package com.clcltd.soaptest;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;

public class SoapTestActivity extends Activity {
    private static final String SOAP_ACTION = "http://testuri.org/simpleMethod";
    private static final String METHOD_NAME = "simpleMethod";
    private static final String NAMESPACE = "http://tempuri.org/";
    private static final String URL = "http://192.168.2.22/wmcmobilewebservice/Service1.asmx";
    PropertyInfo pi;
    TextView tv, tvc;
    String str;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        tv = (TextView) findViewById(R.id.textView1);
        tvc = (TextView) findViewById(R.id.textView2);
        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

        str = "Andy";

        pi = new PropertyInfo();
        pi.setName("srt");
        pi.setValue(str);
        pi.type = PropertyInfo.STRING_CLASS;

        request.addProperty(pi);

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

        HttpTransportSE aht = new HttpTransportSE(URL);
        try{
            aht.call(SOAP_ACTION, soapEnvelope);
            SoapPrimitive resultString = (SoapPrimitive) soapEnvelope.getResponse();
            tv.setText("Status: " + resultString);
            tvc.setText(request.toString());
        }catch (Exception e)
        {
            e.printStackTrace();
            tv.setText("Error" + e.toString());
        }
    }
}

When running the code above, I get the following output on my screen:

Status: Hello
simpleMethod{srt=Andy; }

I would expect the result to be:

Status: Hello Andy

Any ideas?

  • 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-07T00:30:36+00:00Added an answer on June 7, 2026 at 12:30 am

    I spent a while on this, but in the end I found another tutorial (http://sarangasl.blogspot.co.uk/2010/09/create-simple-web-service-in-visual.html) detailing how to use the KSOAP2 webservice on an older version of KSOAP.

    The tutorial includes a link to the code which contains an older version of KSOAP.

    As a test I put the latest KSOAP version in this new Project and it stopped working, so it looks like my issue was version related after all.

    Hopefully pointing others at this tutorial will help them out.

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

Sidebar

Related Questions

I create a ASP.net MVC 4 project by using Visual Studio 2010 IDE. I
I am learning android and trying to create an effect of folding the view
I am learning to create RESTful services using WCF. There are a myriad of
I am currently learning about widgets in Android. I want to create a WIFI
I'm learning about using Custom Views from the following: http://developer.android.com/guide/topics/ui/custom-components.html#modifying The description says: Class
basic question - I'm still learning Android - trying to create a seperate thread
I've been learning android development (in Eclipse) the past week. I'm following online courses
I am a php/mysql developer learning android. I am creating an android app that
hey guys I'm just writing a name getter app as I'm learning android and
Learning how to use Phonegap to create an Android application I am still experimenting

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.