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