Click here to Skip to main content
15,894,896 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Friends,

I'm new to Android programming and this is my first app, However when I press the login button after entering values there is no action. In logcat there is no response in red color which could guide me further. Therefore, I need your kind support.

Many thanks in advance.

What I have tried:

public class MainActivity extends AppCompatActivity {
private static String SOAP_ACTION1 = "http://tempuri.org/Login";
private static String NAMESPACE = "http://tempuri.org/";
private static String Login = "DroidLogin";
private static String URL = "http://ServerName:123/ws_EMS.Android/Service.asmx?WSDL";

On OnButtonClick:
//-----------------------------------------------------------------
public void OnButtonClick(View objView) {
//Initialize SOAP request + add parameters
SoapObject loginRequest = new SoapObject(NAMESPACE, Login);

//Use "request" object to add parameters...
EditText a = (EditText) findViewById(R.id.lblUsername);
EditText b = (EditText) findViewById(R.id.lblPassword);
String str1 = a.getText().toString();
String str2 = b.getText().toString();
String str3 = "intrhh";
String str4 = "123456";
boolean isProd = false;
String str5 = "123123";

loginRequest.addProperty("Username", str1);
loginRequest.addProperty("Password", str2);
loginRequest.addProperty("wsUsername", str3);
loginRequest.addProperty("wsPassword", str4);
loginRequest.addProperty("isProduction", isProd);
loginRequest.addProperty("IMEI", str5);

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(loginRequest);
envelope.dotNet = true;

try
{
HttpsTransportSE androidHttpTransport = new HttpsTransportSE(URL,123,"",1000);

//This is the actual part that will call webservice...
androidHttpTransport.call(SOAP_ACTION1, envelope);

//Get the SOAP result from the envelope body...
SoapObject wsResult = (SoapObject) envelope.bodyIn;

if (wsResult != null)
{
Intent objIntent = new Intent(this, items_confirmation.class);
objIntent.putExtra("Username", str1);

startActivity(objIntent);
}
else
Toast.makeText(getApplicationContext(), "No response from WS", Toast.LENGTH_LONG).show();
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}
//-----------------------------------------------------------------

On items_confirmation.java
public class items_confirmation extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.items_confirmation);

String Username = getIntent().getStringExtra("Username");
TextView objTV1 = (TextView) findViewById(R.id.tvUsername);
objTV1.setText(Username);
}
Posted
Updated 13-Feb-16 23:46pm
v2
Comments
Richard MacCutchan 14-Feb-16 8:04am    
You need to use your debugger to trace what is happening, it is unlikely that anyone here can guess.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900