I am developing a Android app, which communicates with a RESTful WCF Web Service in my server.
By using HttpClient, the application can read the json code from a url link.
For Example:
http://www.example.com/WebService/Service.svc/subscriptions/tiganeus
returns {"JSONUserDataResult":["Application A","Application B"]}
However, this web service itself is anonymous accessible, but protected by ISA Server.
Browser automatically shows "Authentication Required" dialog when this link is accessed externally. Simply fill in the username and password is OK.
I figured out how to do authentication in a webview. The following code works
private class MyWebViewClient extends WebViewClient {
@Override
public void onReceivedHttpAuthRequest(WebView view,
HttpAuthHandler handler, String host, String realm) {
handler.proceed("username", "password");
System.out.println("httpa");
}
}
But what I really need is to read the JSON code from the url. I have chosen to use HttpClient to do the job, but I can't figure out how to authenicate within the HttpClient. It sounds simple as any browser can do it.
Any help will be appreciated.