Skip to main content
se eliminaron 26 caracteres en el cuerpo
Origen Enlace
    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();
}
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);
                SoapPrimitive resultado = (SoapPrimitive)envelope.getResponse();
                res = resultado.toString();
            }catch(IOException e){
                e.printStackTrace();
            }catch (XmlPullParserException e){
                e.printStackTrace();
            }

            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();
}
    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);
                SoapObject resultado = (SoapObject) 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();
                }
            });
        }
    };
    nt.start();
}
se añadieron 368 caracteres en el cuerpo
Origen Enlace

Dato importante que pasé por alto, independientemente de dar permiso de Internet en el manifest se de be de agregar esto:

  ConnectivityManager cm =

(ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);

NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
boolean isConnected = activeNetwork.isConnectedOrConnecting();

Dato importante que pasé por alto, independientemente de dar permiso de Internet en el manifest se de be de agregar esto:

  ConnectivityManager cm =

(ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);

NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
boolean isConnected = activeNetwork.isConnectedOrConnecting();
se añadieron 73 caracteres en el cuerpo
Origen Enlace

servicio

servicio

Origen Enlace
Loading