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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:20:38+00:00 2026-06-01T04:20:38+00:00

I am creating an application in which I want to access a web service

  • 0

I am creating an application in which I want to access a web service and perform a particular task like if I enter the two number into the edit Text and click on the button the addition or subtraction or whatever shows on to the screen. and I do not want to use the local database of Android.

Means my back-end process or say logic’s are already created in SQl Sever. But I don’t know how to call or access the functionality of web services in Android. Please Help me Out.

Thanks in Advance for Any Help……..

  • 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-01T04:20:40+00:00Added an answer on June 1, 2026 at 4:20 am

    Amit you haven’t searched well on google for this because if you did so you didn’t ask this question here.There are lot of tutorial for this on net if let yourself search on net.Anyways i am posting the code snippet to demonstrate that how you can call the webservice from android…This code is to call only SOAP webservice.To call other webservices like JSON,REST etc search yourself on net.

    CODE:-

    public class HelloWebService extends Activity{
    
        String SOAP_ACTION="http://tempuri.org/HelloWorld";
        String METHOD_NAME = "HelloWorld";
        String NAMESPACE = "http://tempuri.org/";
        String URL = "http://192.168.1.15:80/himanshu/helloworldwebservice.asmx";
        String SUM_SOAP_ACTION="http://tempuri.org/AddNumbers";
        String METHOD_NAME1 = "AddNumbers";
    
        TextView tv1,tv2,tv3,tv4,tv5;
        EditText etA,etB,etName;
        Button bt,dis;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            // TODO Auto-generated method stub
            super.onCreate(savedInstanceState);
            setContentView(R.layout.hello);
    
            etName = (EditText)findViewById(R.id.et);
            tv1 = (TextView)findViewById(R.id.tv1);
            tv2 = (TextView)findViewById(R.id.tv2);
            tv3 = (TextView)findViewById(R.id.tv3);
            tv4 = (TextView)findViewById(R.id.tv4);
            tv5 = (TextView)findViewById(R.id.tv5);
            etA = (EditText)findViewById(R.id.editA);
            etB = (EditText)findViewById(R.id.editB);
            bt =  (Button)findViewById(R.id.add);
            dis = (Button)findViewById(R.id.display);
    
            bt.setOnClickListener(new View.OnClickListener() {
    
                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
    
                    sum();
                }
            });
    
            dis.setOnClickListener(new View.OnClickListener() {
    
                @Override
                public void onClick(View v) {
                    Hello();    
                }
            });
    
        }
    
        public void Hello(){
    
            SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
            Log.d("request", request.toString());
    
            String str = etName.getText().toString();
            Log.d("str", str);
    
            request.addProperty("name", str);
            Log.d("request", request.toString());
    
            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
            Log.d("envelope", envelope.toString());
            envelope.dotNet = true;
            envelope.setOutputSoapObject(request);
            Log.d("envelope", envelope.toString());
            HttpTransportSE aht = new HttpTransportSE(URL);
            aht.debug=true;
            Log.d("aht", aht.toString());
    
            try
            {
                aht.call(SOAP_ACTION, envelope);
                SoapPrimitive results = (SoapPrimitive)envelope.getResponse();
                Log.d("result", results.toString());
                tv1.setText(""+results.toString());
            }
            catch (Exception e)
            {
                tv2.setText(e.getClass().toString());
                Log.d("Error",e.getClass().toString());
            }
    
        }
    
        public void sum(){
    
                SoapObject sum_request = new SoapObject(NAMESPACE, METHOD_NAME1);
                Log.d("sum_request", sum_request.toString());
    
                //PropertyInfo pro1 = new PropertyInfo();
                String strA = etA.getText().toString();
                String strB = etB.getText().toString();
                sum_request.addProperty("a", strA);
                sum_request.addProperty("b", strB);
    
                Log.d("sum_request", sum_request.toString());
    
                SoapSerializationEnvelope sum_envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
                Log.d("sum_envelope", sum_envelope.toString());
    
                sum_envelope.dotNet = true;
                sum_envelope.setOutputSoapObject(sum_request);
                Log.d("sum_envelope", sum_envelope.toString());
    
                HttpTransportSE sum_aht = new HttpTransportSE(URL);
                sum_aht.debug=true;
                Log.d("sum_aht", sum_aht.toString());
    
                try
                {
                    sum_aht.call(SUM_SOAP_ACTION, sum_envelope);
                    SoapPrimitive sum_results = (SoapPrimitive)sum_envelope.getResponse();
                    Log.d("sum_result", sum_results.toString());
                  //  int in = Integer.parseInt(sum_results.getProperty(0).toString());
                    tv3.setText(""+sum_results.toString());
                }
                catch (Exception e)
                {
                    tv3.setText(e.getClass().toString());
                    Log.d("sum_error", e.getClass().toString());
                }
    
            }
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating an application which involves so many web-service calls. I am using
I am creating an application in which I have two mxml components, MainPanel.mxml and
I am creating a web application which has a few management screens, where a
i am working on project in which we are creating a web service that
I'm creating a web application using asp.net & WCF as 3 tier architecture, which
I'm creating a new web application (Rails 3 beta), of which pieces of it
I'm creating an application which lets you define events with a time frame. I
I am creating an application which displays some messages and its directions in the
I'm creating an application which communicates with the device via FT2232H USB/RS232 converter. For
I am creating an application which tracks the users location using GPS, stores the

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.