Antochristian
Lurker
I've written web service using php.I invoke the web service by android application but i couldnt invoke the web service because of some issues . i couldn't solve the problem.pls try to help to solve the issue.I've posted my code below
this is login code
SoapObject userRequest=new SoapObject(NAMESPACE, METHOD_NAME);
userRequest.addProperty("email", email); // login-account
userRequest.addProperty("password", password); // login-password
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("UserLogin", userRequest); // login-account
SoapSerializationEnvelope envelope = new
SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.bodyOut = request;
HttpTransportAndroid androidHttpTransport = new HttpTransportAndroid(URL);
I've written web service using php.I invoke the web service by android application but i
couldnt invoke the web service because of some issues . i couldn't solve the problem.pls try to
help to solve the issue.I've posted my code below
this is login code
Button btnLogin= (Button)findViewById(R.id.Button01);
btnLogin.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
try
{
final String SOAP_ACTION2 = "http://tempuri.org/Login";
//final String SOAP_ACTION2 = "http://www.binarch.com/Clientele/BBAPI/Login";
final String METHOD_NAME2 = "Login";
//final String NAMESPACE2 = "http://tempuri.org/";
final String NAMESPACE2 = "http://www.binarch.com/Clientele/BBAPI/index.php";
final String URL2 = "http://www.binarch.com/Clientele/BBAP/index.php?wsdl";
EditText userid = (EditText) findViewById(R.id.editText1);
EditText password = (EditText) findViewById(R.id.editText2);
SoapObject request = new SoapObject(NAMESPACE2, METHOD_NAME2);
request.addProperty("username", userid.getText().toString());
request.addProperty("password", password.getText().toString());
SoapSerializationEnvelope envelope = new
SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.bodyOut=true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL2);
androidHttpTransport.call(SOAP_ACTION2, envelope);
Object result = (Object)envelope.getResponse();
String quess=result.toString();
if(quess=="1")
{
Toast.makeText(BookingBano_AndroidActivity.this, "Welcome",
Toast.LENGTH_SHORT).show();
Intent otherIntent = new
Intent(BookingBano_AndroidActivity.this,Customer_Enquries.class);
startActivity(otherIntent);
}
else
{
Toast.makeText(BookingBano_AndroidActivity.this, "Try again later.",
Toast.LENGTH_SHORT).show();
}
}
catch(Exception ex)
{
TextView TV=(TextView)findViewById(R.id.textView1);
TV.setText("Testing1"+ex.toString());
}
}
});
**androidHttpTransport.call(SOAP_ACTION2, envelope);**// This line only i got an exception
this is login code
SoapObject userRequest=new SoapObject(NAMESPACE, METHOD_NAME);
userRequest.addProperty("email", email); // login-account
userRequest.addProperty("password", password); // login-password
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("UserLogin", userRequest); // login-account
SoapSerializationEnvelope envelope = new
SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.bodyOut = request;
HttpTransportAndroid androidHttpTransport = new HttpTransportAndroid(URL);
I've written web service using php.I invoke the web service by android application but i
couldnt invoke the web service because of some issues . i couldn't solve the problem.pls try to
help to solve the issue.I've posted my code below
this is login code
Button btnLogin= (Button)findViewById(R.id.Button01);
btnLogin.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
try
{
final String SOAP_ACTION2 = "http://tempuri.org/Login";
//final String SOAP_ACTION2 = "http://www.binarch.com/Clientele/BBAPI/Login";
final String METHOD_NAME2 = "Login";
//final String NAMESPACE2 = "http://tempuri.org/";
final String NAMESPACE2 = "http://www.binarch.com/Clientele/BBAPI/index.php";
final String URL2 = "http://www.binarch.com/Clientele/BBAP/index.php?wsdl";
EditText userid = (EditText) findViewById(R.id.editText1);
EditText password = (EditText) findViewById(R.id.editText2);
SoapObject request = new SoapObject(NAMESPACE2, METHOD_NAME2);
request.addProperty("username", userid.getText().toString());
request.addProperty("password", password.getText().toString());
SoapSerializationEnvelope envelope = new
SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.bodyOut=true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL2);
androidHttpTransport.call(SOAP_ACTION2, envelope);
Object result = (Object)envelope.getResponse();
String quess=result.toString();
if(quess=="1")
{
Toast.makeText(BookingBano_AndroidActivity.this, "Welcome",
Toast.LENGTH_SHORT).show();
Intent otherIntent = new
Intent(BookingBano_AndroidActivity.this,Customer_Enquries.class);
startActivity(otherIntent);
}
else
{
Toast.makeText(BookingBano_AndroidActivity.this, "Try again later.",
Toast.LENGTH_SHORT).show();
}
}
catch(Exception ex)
{
TextView TV=(TextView)findViewById(R.id.textView1);
TV.setText("Testing1"+ex.toString());
}
}
});
**androidHttpTransport.call(SOAP_ACTION2, envelope);**// This line only i got an exception