Search code examples
androidgitweb-servicesnetbeansksoap2

Android ksoap2 not working after downloading project from git


I have an android client consuming a netbeans webservice with ksoap2 library. It was working perfectly until yesterday, when I had to format my computer.

I downloaded my project from git and now it's not working, it just keeps giving me timeout exception, even though the webservice works perfectly.

This is the class that consumes the webservice:

private class AsyncCallWSVerificaUsuario extends AsyncTask<String, Void, Void> {

private final String NAMESPACE = "http://ws/";
private final String URL = "http://localhost:8080/ColecaoFilmes/ColecaoFilmes";
private final String SOAP_ACTION = "http://localhost:8080/ColecaoFilmes/ColecaoFilmes/verificaUsuario";
private final String METHOD_NAME = "verificaUsuario";

        @Override
        protected Void doInBackground(String... params) {
            getResposta();
            return null;
        }

        @Override
        protected void onPostExecute(Void result) {

        }

        @Override
        protected void onPreExecute() {

        }

        @Override
        protected void onProgressUpdate(Void... values) {
        }

        public void getResposta() {
            //Create request
            SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

            PropertyInfo login = new PropertyInfo();
            login.type = PropertyInfo.STRING_CLASS;
            login.setValue(loginCadastro.getText().toString());
            login.setName("login");
            login.setType((String.class));
            request.addProperty(login);

            PropertyInfo senha = new PropertyInfo();
            senha.type = PropertyInfo.STRING_CLASS;
            senha.setValue(senhaCadastro.getText().toString());
            senha.setName("senha");
            senha.setType((String.class));
            request.addProperty(senha);

            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
            envelope.setOutputSoapObject(request);
            HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

            try {
                androidHttpTransport.call(SOAP_ACTION, envelope);
                SoapPrimitive response = (SoapPrimitive) envelope.getResponse();

            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

My netbeans webservice:

netbeans webservice

Am I forgetting something? I just don't get it, it was working just before I had to format my computer, and my local version was exactly like the last version on the git repository.


Solution

  • So, if it helps anyone, here's what happened. There was nothing wrong with my project, the problem was just switching my network location on windows from public to private. If only I had known this before, I wouldn't have lost a week of debugging and praying.