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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:51:02+00:00 2026-06-01T02:51:02+00:00

I tried to call a .NET web service with KSOAP2 and it throws an

  • 0

I tried to call a .NET web service with KSOAP2 and it throws an exception at androidHttpTransport.call(SOAP_ACTION, envelope) and thus return result="m".

What should I do so that it will call the function?

Here is my code:

public class LoginActivity extends Activity {

private static final String NAMESPACE = "http://tempuri.org/" ;
private static final String METHOD_NAME = "login";
private static final String SOAP_ACTION = NAMESPACE + METHOD_NAME;
private static final String URL = "http://192.168.8.2/CompiledWebSite/WebService.asmx";


private EditText et_id,et_pwd;
private Button btn_login;

public String login(String str_id, String str_pwd){
    String result ="a";
    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
    request.addProperty("s_id", str_id);
    request.addProperty("pw", str_pwd);

    SoapSerializationEnvelope envelope =
    new SoapSerializationEnvelope(SoapEnvelope.VER11);
    envelope.dotNet =  true;
    envelope.setOutputSoapObject(request);
    HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

    try
    {

    androidHttpTransport.call(SOAP_ACTION, envelope);

    SoapPrimitive Result = (SoapPrimitive)envelope.getResponse();

    result = Result.toString();
    }
    catch(Exception e) 
    {
        result="m";
    }
    return result;          
}

 @Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        btn_login = (Button) findViewById(R.id.BnLogin);
        et_id = (EditText) findViewById(R.id.ETStudentID);
        et_pwd = (EditText) findViewById(R.id.ETPassword);

        btn_login.setOnClickListener(new Button.OnClickListener()
        {
            public void onClick(View v){

                String str_id, str_pwd;
                str_id = et_id.getText().toString();
                str_pwd = et_pwd.getText().toString();

                if (login(str_id,str_pwd)=="true"){
                     Toast toast=Toast.makeText(LoginActivity.this, str_id, 500);
                     toast.setGravity(1, 1, 1);

                     toast.show();
                }else{
                     Toast toast=Toast.makeText(LoginActivity.this, login(str_id,str_pwd), 500);
                     toast.setGravity(1, 1, 1);

                     toast.show();
                }
            }


        });

    }


 }

Thanks!

  • 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-01T02:51:04+00:00Added an answer on June 1, 2026 at 2:51 am

    I found the solution.
    I add following code to AndroidManifest.xml

    <uses-permission android:name="android.permission.INTERNET" />
    

    then add following code to onCreate()

    StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()     
    .detectDiskReads()     
    .detectDiskWrites()     
    .detectNetwork()   // or .detectAll() for all detectable problems     
    .penaltyLog()     
    .build());     
    StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()     
    .detectLeakedSqlLiteObjects()     
    .detectLeakedClosableObjects()     
    .penaltyLog()     
    .penaltyDeath()     
    .build());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanted to know it is possible to call a hosted .net web service
I'd like to trap any unhandled exception thrown in an ASP.NET web service, but
I call a .Net web service from my Blackberry app. After having nothing but
I tried to call linq query from sliverlight application to web service which is
I have a WCF ASP.Net 4.0 web service we'll call WebService. WebService is consuming
I am building an ASP.NET web service that will be used internally in my
I am having issues calling an ASP.NET web service in JQuery. I am basically
I am using jQuery to call web service (*.asmx) methods. The web service uses
I have to call a third-party Web service that frequently does not respond. I
I need to call a web service to receive a JSON object which I'll

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.