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

  • Home
  • SEARCH
  • 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 6657047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:43:07+00:00 2026-05-26T01:43:07+00:00

I am using the following code which i found on internet to call a

  • 0

I am using the following code which i found on internet to call a web service from my android app:

public class WebServiceActivity extends Activity {
    private static final String SOAP_ACTION = "http://tempuri.org/HelloWorld";

    private static final String METHOD_NAME = "HelloWorld";

    private static final String NAMESPACE = "http://tempuri.org/";
    private static final String URL = "http://192.168.1.19/TestWeb/WebService.asmx";


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



        Button getquote = (Button) findViewById(R.id.getquote);  
        getquote.setOnClickListener(new OnClickListener() {  

        public void onClick(View v) { 
            TextView result1;
            result1=(TextView)findViewById(R.id.result1);
        try {


            SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
            EditText CompanyName = (EditText) findViewById(R.id.CompanyName); 
            String val1 = (CompanyName.getText().toString());
            request.addProperty("passonString", val1);

            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();

            result1.setText(result.toString());
        } catch (Exception e) {

            result1.setText(e.getMessage());
            }
    }
});

}

}

I am getting error that application is not responding.I am new in the field , please help.
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-05-26T01:43:08+00:00Added an answer on May 26, 2026 at 1:43 am

    Put your web service request as a background task. Usually time taken by a network activity is unpredictable. If you use above, the UI Thread will block. That is why it says “Application not responding”.

    I found this great article.
    http://www.vogella.de/articles/AndroidPerformance/article.html#concurrency
    Have a look at 2. Background Processing

    Your example can be modified as following.

    public class WebServiceActivity extends Activity {
        private static final String SOAP_ACTION = "http://tempuri.org/HelloWorld";
    
        private static final String METHOD_NAME = "HelloWorld";
    
        private static final String NAMESPACE = "http://tempuri.org/";
        private static final String URL = "http://192.168.1.19/TestWeb/WebService.asmx";
    
        TextView result1;
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
            result1 = (TextView) findViewById(R.id.result1);
    
            Button getquote = (Button) findViewById(R.id.getquote);
            getquote.setOnClickListener(new OnClickListener() {
    
                public void onClick(View v) {
    
                    // push soap request into background.
                    new Thread(new Runnable(){
    
                        @Override
                        public void run() {
                            doSoapRequest();
                        }
    
                    },"DOINBACKGROUND");
                }
            });
    
        }
    
        private void doSoapRequest(){
            try {
    
                SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
                EditText CompanyName = (EditText) findViewById(R.id.CompanyName);
                String val1 = (CompanyName.getText().toString());
                request.addProperty("passonString", val1);
    
                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();
    
    //          result1.setText(result.toString());
    //           update UI data in a Handler
                Message msg = new Message();
                msg.obj = result.toString();
                result1Handler.sendMessage(msg);
            } catch (Exception e) {
    
    //          result1.setText(e.getMessage());
    //           update UI data in a Handler
                Message msg = new Message();
                msg.obj = e.getMessage();
                result1Handler.sendMessage(msg);
            }
        }
    
        private Handler result1Handler = new Handler(){
            @Override
            public void handleMessage(Message msg) {
                super.handleMessage(msg);
                result1.setText(msg.obj.toString());
            }
    
        };
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using he following code the call a CFC which returns auto-suggest results through
I am using the following code which I have found online def c_int_binary_search(seq,t): #
I'm using the following code to post to the server which is then sent
Given the following lines of code which is using JQTOUCH: $('#customers').bind('pageAnimationEnd', function(e, info){ if
I'm using following code but cannot return data from MySQL. This is the output:
i'm using the following code to open site in internet explorer ProcessStartInfo startInfo =
I'm using the following code to create an xls file from php. http://www.appservnetwork.com/modules.php?name=News&file=article&sid=8 However,
I have the following php code which I found here : function download_xml() {
I am using the following code to remove an element from the DOM tree:
i have following code,which does not show me anything #include <iostream> using namespace std;

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.