public void Cita(View v) {
Thread nt = new Thread(){
EditText nombre = (EditText)findViewById(R.id.txtNombre);
EditText apellido = (EditText)findViewById(R.id.txtApellido);
EditText fecha = (EditText)findViewById(R.id.txtFecha);
EditText empleado = (EditText)findViewById(R.id.txtEmpleado);
EditText servicio = (EditText)findViewById(R.id.txtServicio);
String res;
@Override
public void run(){
String NAMESPACE = "http://tempuri.org/";
String URL = "http://192.168.1.253/ServidorWeb/SWS.asmx";
String METHOD_NAME = "AgregarCita";
String SOAP_ACTION = "http://tempuri.org/AgregarCita";
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("nombre",nombre.getText().toString());
request.addProperty("apellido",apellido.getText().toString());
request.addProperty("fecha",fecha.getText().toString());
request.addProperty("idEmpleado",Integer.parseInt(empleado.getText().toString()));
request.addProperty("idServicio",Integer.parseInt(servicio.getText().toString()));
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE transporte = new HttpTransportSE(URL);
try{
transporte.call(SOAP_ACTION, envelope);
SoapPrimitiveSoapObject resultado = (SoapPrimitiveSoapObject) envelope.getResponse();
res = resultado.toString();
res += "Agregado";
}catch(IOException e){
e.printStackTrace();
res += "Error";
}catch (XmlPullParserException e){
e.printStackTrace();
res += "Error2";
}
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(InsertaCita.this, res, Toast.LENGTH_SHORT).show();
//EditText result = (EditText)findViewById(R.id.txtResultado);
//result.setText(res);
}
});
}
};
nt.start();
}