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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:35:48+00:00 2026-06-06T20:35:48+00:00

I am trying to connect my App to a Web Service that I created

  • 0

I am trying to connect my App to a Web Service that I created in ASP and is currently running on localhost. The App is trying to access the Coordonate method that takes in 3 integers.

I have provided the code and the LogCat. I have to mention that I’m new to web services.

Any help will be greatly appreciated! Cheers!

Code:

package Dan.Denver.Nuggets.googleMaps;

import android.app.Activity;
import android.app.AlertDialog;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.SeekBar;
import android.widget.Toast;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;

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

public class SlideBar extends Activity
{
SeekBar seekBar;
TextView textView;
Button sendButton;

private static final String SOAP_ACTION = "http://tempuri.org/Coordonate";
private static final String METHOD_NAME = "Coordonate";
private static final String NAMESPACE = "http://tempuri.org/";
private static final String URL = "http://localhost:49934/Service1.asmx";

SoapObject request;
SoapSerializationEnvelope soapEnvelope;
HttpTransportSE transport;
SoapPrimitive rezultat;

@Override
protected void onCreate(Bundle savedInstanceState) 
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.slidebar);
    textView = (TextView)findViewById(R.id.textView); 
    sendButton = (Button)findViewById(R.id.bSB);

    seekBar = (SeekBar)findViewById(R.id.sbSB);
    seekBar.setMax(100);
    seekBar.setProgress(1);

    seekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() 
    {   
        public void onStopTrackingTouch(SeekBar seekBar)
        {
            // TODO Auto-generated method stub
        }

        public void onStartTrackingTouch(SeekBar seekBar)
        {
            // TODO Auto-generated method stub
        }

        public void onProgressChanged(SeekBar seekBar, int progress,
                boolean fromUser) 
        {
            textView.setText(String.valueOf(progress + "%"));
//              if(progress >= 25 && progress < 50)
//                  textView.setTextColor(R.color.Yellow);
//              else if(progress >= 50 && progress < 75)
//                  textView.setTextColor(R.color.Orange);
//              else if(progress >= 75 && progress <= 100)
//                  textView.setTextColor(R.color.Red);
//              else 
//                  textView.setTextColor(R.color.Green);   
        }
    });

    sendButton.setOnClickListener(new View.OnClickListener() 
    {   
        public void onClick(View v) 
        {
            // TODO Auto-generated method stub
            //Toast.makeText(getBaseContext(), "Drumul este congestionat in proportie de "+textView.getText().toString(), Toast.LENGTH_LONG).show();
            request = new SoapObject(NAMESPACE, METHOD_NAME);
            request.addProperty("latitudine", Main.latitudine);
            request.addProperty("longitudine", Main.longitudine);
            request.addProperty("procentTrafic", seekBar.getProgress());

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

            transport = new HttpTransportSE(URL);
            try
            {
                transport.call(SOAP_ACTION, soapEnvelope);
                rezultat = (SoapPrimitive)soapEnvelope.getResponse();
                Toast.makeText(getBaseContext(), rezultat.toString(), Toast.LENGTH_LONG).show();
            }
            catch(Exception e)
            {
                e.printStackTrace();
            }           
        }
    });
}
}

LogCat:

07-01 17:11:56.790: E/AndroidRuntime(1029): FATAL EXCEPTION: main
07-01 17:11:56.790: E/AndroidRuntime(1029): java.lang.NoClassDefFoundError: org.ksoap2.serialization.SoapObject
07-01 17:11:56.790: E/AndroidRuntime(1029):     at Dan.Denver.Nuggets.googleMaps.SlideBar$2.onClick(SlideBar.java:80)
07-01 17:11:56.790: E/AndroidRuntime(1029):     at android.view.View.performClick(View.java:2408)
07-01 17:11:56.790: E/AndroidRuntime(1029):     at android.view.View$PerformClick.run(View.java:8816)
07-01 17:11:56.790: E/AndroidRuntime(1029):     at android.os.Handler.handleCallback(Handler.java:587)
07-01 17:11:56.790: E/AndroidRuntime(1029):     at android.os.Handler.dispatchMessage(Handler.java:92)
07-01 17:11:56.790: E/AndroidRuntime(1029):     at android.os.Looper.loop(Looper.java:123)
07-01 17:11:56.790: E/AndroidRuntime(1029):     at android.app.ActivityThread.main(ActivityThread.java:4627)
07-01 17:11:56.790: E/AndroidRuntime(1029):     at java.lang.reflect.Method.invokeNative(Native Method)
07-01 17:11:56.790: E/AndroidRuntime(1029):     at java.lang.reflect.Method.invoke(Method.java:521)
07-01 17:11:56.790: E/AndroidRuntime(1029):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-01 17:11:56.790: E/AndroidRuntime(1029):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-01 17:11:56.790: E/AndroidRuntime(1029):     at dalvik.system.NativeStart.main(Native Method)
07-01 17:12:00.229: I/Process(1029): Sending signal. PID: 1029 SIG: 9
  • 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-06T20:35:50+00:00Added an answer on June 6, 2026 at 8:35 pm

    Try replacing localhost with IP address of your system in following line.

    private static final String URL = "http://localhost:49934/Service1.asmx";
    

    This might help you.

    As even if you are testing it on emulator running on same system then also both asp.net and android have different IP for localhost maybe 10.0.2.2 in some cases.

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

Sidebar

Related Questions

I get the following error message when trying to connect a web app running
I have a web service app - that I need to connect to a
I am trying to create an android app that will connect to various web
I am trying to connect my tablet to a Web Service that I have
I'm trying to figure out how to design an iOS app that would connect
I am trying to write an Android app to connect to an existing web
I'm trying to make a web app that will manage my Mercurial repositories for
I'm trying to configure OAuth into my iPhone app to connect to another web
I am trying to develop a web app with eclipse that uses a derby
I am trying to make a Facebook Connect web app more mobile friendly. I

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.