Accessing different Webservices on Android

Asked

Viewed 94 times

0

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

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 this, any other function I’ve created in this app, is functional. Only it only works on . COM, and not . BR, the two webservices are IDENTICAL, literally, only changes . com and . br Why might I not be able to access it? It always gives 404 page error not found in Logcat, but the link and Ws actually exist, tested and etc. And there’s no way my code is wrong, because if it works for one, the other has to work equally..

Where I might be missing?

If you need more data, let me know, because I don’t know a solution to this..

  • Testing by another client, other than on the device, works?

  • works in Visual Studio, by the browser itself.. I have no answers to what it might be.. @Wakim

  • @Wakim, do you have any suggestions for me? I’m desperate

  • I don’t have much idea, maybe it is good to put the code that calls the Web Service and that defines these URL’S.

1 answer

1

From what I understand you get one of the two Urls. So why at the point where you get the URL you don’t 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();

This way, you will run any URL passed. Check only the need to use HttpPost.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.