Accessing different Webservices on Android

0

I have an app that I'm developing for my company, the first part, is to login, through the webservices, after login, it automatically makes another connection to the webservice that returns a URL to it, which for each client will have one of the 2 existing URLs.

For example:

www.dominio.com/ws/mobile.asmx
www.dominio.com.br/ws/mobile.asmx

The difference as you can see is .br

What happens is the following, any other function I created in this app, are functional. But it only works in .COM, not in .BR, the two webservices are IDENTICAL, literally, it only changes .com and .br Why can not I be able to access? There is always a page 404 error not found in Logcat, but the link and the ws actually exist, tested, and so on. And it does not have how my code is wrong, because if it works for one, the other has to function equally.

Where can I be wrong?

If you need more data, tell me, because I do not know a solution to this.

    
asked by anonymous 20.10.2014 / 15:32

1 answer

1

As I understand it, you get one of two URLs. So why at the point where you get the URL you do not do something like this:

Thread thread = new Thread(new Runnable() {
    @Override
    public void run() {
        try {
            HttpPost post = new HttpPost("sua url");
            HttpClient client = new DefaultHttpClient();
            HttpResponse response;
            try {
                response = client.execute(post);
                HttpEntity httpEntity = response.getEntity();
                EntityUtils.toString(httpEntity); // Vai imprimir a resposta como json.
            } catch (ClientProtocolException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
});
thread.start();

In this way, you will run any past URL. Check only the need to use HttpPost .

    
22.10.2014 / 21:46