Android Web Service Connection ERROR

i created java soap web services and trying to connect it with android app.I have created a table im databse as login and given the fields.The problem is my android app code is not connectimg and getting data .It is showing no error the xml login page os loading but no action in button.If i check the logcat there is no error .I have posted the code and logcat Please help me out ASAP.

package com.androidlogin.androidmysql;

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;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;


    public class AndroidLoginActivity extends Activity {
     private final String NAMESPACE = "//hello.android.com";
        private final String URL = "http://192.168.1.210:8090/Myapp/services/Hello?wsdl";
        private final String SOAP_ACTION = "//hello.android.com/sayHello";
        private final String METHOD_NAME = "sayHello";
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            Button login = (Button) findViewById(R.id.btn_login);
            login.setOnClickListener(new View.OnClickListener() {

       public void onClick(View arg0) {
        loginAction();
         //Toast.makeText(AndroidLoginActivity.this, "successfull", Toast.LENGTH_SHORT).show();
       }
      });
        }

       private void loginAction(){
         SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

            EditText userName = (EditText) findViewById(R.id.tf_userName);
            String user_Name = userName.getText().toString();
            EditText userPassword = (EditText) findViewById(R.id.tf_password);
            String user_Password = userPassword.getText().toString();

          //Pass value for userName variable of the web service
            PropertyInfo unameProp =new PropertyInfo();
            unameProp.setName("userName");//Define the variable name in the web service method
            unameProp.setValue(user_Name);//set value for userName variable
            unameProp.setType(String.class);//Define the type of the variable
            request.addProperty(unameProp);//Pass properties to the variable

          //Pass value for Password variable of the web service
            PropertyInfo passwordProp =new PropertyInfo();
            passwordProp.setName("password");
            passwordProp.setValue(user_Password);
            passwordProp.setType(String.class);
            request.addProperty(passwordProp);

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

            try{
                androidHttpTransport.call(SOAP_ACTION, envelope);
                   SoapPrimitive response = (SoapPrimitive)envelope.getResponse();

                   TextView result = (TextView) findViewById(R.id.tv_status);
                   result.setText(response.toString());

            }
            catch(Exception e){

            }
           }

    }


    **LOGCAT:**


        10-22 15:14:21.614: D/dalvikvm(3946): GC_FOR_MALLOC freed 2697 objects / 408656 bytes in 36ms
        10-22 15:14:28.724: D/dalvikvm(3946): GC_FOR_MALLOC freed 1314 objects / 329208 bytes in 44ms
        10-22 15:14:30.644: D/dalvikvm(3946): GC_FOR_MALLOC freed 662 objects / 305112 bytes in 43ms
        10-22 15:14:31.724: D/dalvikvm(3946): GC_FOR_MALLOC freed 659 objects / 305040 bytes in 43ms
        10-22 15:14:37.695: D/dalvikvm(3946): GC_FOR_MALLOC freed 685 objects / 305872 bytes in 31ms
        10-22 15:14:38.805: D/dalvikvm(3946): GC_FOR_MALLOC freed 661 objects / 305112 bytes in 43ms
        10-22 15:14:39.035: D/dalvikvm(3946): GC_FOR_MALLOC freed 657 objects / 305008 bytes in 30ms
        10-22 15:14:39.245: D/dalvikvm(3946): GC_FOR_MALLOC freed 655 objects / 304920 bytes in 29ms
        10-22 15:14:41.484: W/KeyCharacterMap(3946): No keyboard for id 0
        10-22 15:14:41.484: W/KeyCharacterMap(3946): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
        10-22 15:14:43.064: D/dalvikvm(3946): GC_FOR_MALLOC freed 760 objects / 308400 bytes in 41ms
        10-22 15:14:44.334: D/dalvikvm(3946): GC_FOR_MALLOC freed 661 objects / 305080 bytes in 34ms
        10-22 15:14:46.424: D/dalvikvm(3946): GC_FOR_MALLOC freed 680 objects / 305784 bytes in 35ms
        10-22 15:14:47.624: D/dalvikvm(3946): GC_FOR_MALLOC freed 660 objects / 305104 bytes in 40ms
        10-22 15:14:47.854: D/dalvikvm(3946): GC_FOR_MALLOC freed 656 objects / 304960 bytes in 31ms
        10-22 15:14:48.064: D/dalvikvm(3946): GC_FOR_MALLOC freed 655 objects / 304928 bytes in 31ms
        10-22 15:14:48.284: D/dalvikvm(3946): GC_FOR_MALLOC freed 656 objects / 304896 bytes in 30ms
        10-22 15:14:48.504: D/dalvikvm(3946): GC_FOR_MALLOC freed 656 objects / 304936 bytes in 30ms
        10-22 15:14:48.724: D/dalvikvm(3946): GC_FOR_MALLOC freed 656 objects / 305000 bytes in 30ms
        10-22 15:15:59.594: W/KeyCharacterMap(3946): No keyboard for id 0
        10-22 15:15:59.604: W/KeyCharacterMap(3946): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
        10-22 15:15:59.725: W/IInputConnectionWrapper(3946): showStatusIcon on inactive InputConnection
        10-22 15:16:15.134: D/dalvikvm(3946): GC_EXPLICIT freed 830 objects / 309928 bytes in 117ms
        10-22 15:17:41.604: D/dalvikvm(3946): GC_FOR_MALLOC freed 943 objects / 316984 bytes in 31ms
        10-22 15:21:55.215: W/KeyCharacterMap(3991): No keyboard for id 0
        10-22 15:21:55.215: W/KeyCharacterMap(3991): Using default keymap: /system/usr/keychars/qwerty.kcm.bin

Upvotes: 0

Views: 755

Answers (4)

Job
Job

Reputation: 45

Upvotes: 0

ManNi PandiT
ManNi PandiT

Reputation: 76

You need to check your logcat.First of all include - Log.i("MyApp", e.getMessage()); in your catch and then you see the error and post your logcat to see what error you get

Upvotes: 0

Eugene
Eugene

Reputation: 656

Please don't do that

catch(Exception e){

        }

your logcat is empty because of that

You might use

 catch (Exception ex) {
    ex.printStackTrace();
}

instead

Upvotes: 0

Diego Palomar
Diego Palomar

Reputation: 7061

Obviously you are not seeing any error because you do not have any code in within the catch clause. To see a detailed description of the possible error modify your code in this way (Add the logcat filter MyApp in the DDMS):

try {
        androidHttpTransport.call(SOAP_ACTION, envelope);
        SoapPrimitive response = (SoapPrimitive)envelope.getResponse();

        TextView result = (TextView) findViewById(R.id.tv_status);
        result.setText(response.toString());

}
catch(Exception e){
        Log.i("MyApp", e.getMessage());
}

Upvotes: 1

Related Questions