Antenna HTTP authentication on the Lotus Domino server

I am developing an Android application that can read data from a Lotus Domino database. I started creating an HTTP authentication page, and I ran into a lot of difficulties. This is my piece of code:

    public void GoAuth(View v){
    final String httpsURL = "http://xxx.xxx.xxx.xxx/names.nsf/mypage?openpage";
    final DefaultHttpClient client = new DefaultHttpClient();
    final HttpPost httppost = new HttpPost(httpsURL);

    String userName = "demo";
    String password = "demo";

    try {
        //authentication block:
        final List<BasicNameValuePair> nvps = new ArrayList<BasicNameValuePair>();
        nvps.add(new BasicNameValuePair("Username", userName));
        nvps.add(new BasicNameValuePair("Password", password));
        final UrlEncodedFormEntity p_entity = new UrlEncodedFormEntity(nvps, HTTP.UTF_8);
        httppost.setEntity(p_entity);

        //sending the request and retrieving the response:
        HttpResponse response = client.execute(httppost);
        HttpEntity responseEntity = response.getEntity();

        if (response.getStatusLine().getStatusCode() == HttpURLConnection.HTTP_OK){
            //handling the response 
            final InputSource inputSource = new InputSource(responseEntity.getContent());
            TextView res=(TextView)findViewById(R.id.result);
            res.setText("Server response: "+inputSource.toString());
        }

    } catch (UnsupportedEncodingException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (ClientProtocolException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IllegalStateException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }


}

Server response: org.xml.sax InputSource @ 40575700

Trying the same in the browser, I see the login page and after that the content is "mypage". I am a little confused with the correct approach and mechanism that I have to follow on Android. Any help would be greatly appreciated!

+3
source share
3 answers

, , , " , .

" HTTP", , , ( / ), / .

. Domino 7.0.2

+2

, Android-, Lotus Domino:

    private boolean authenticateWithDomino() throws Exception {

    String fullLoginUrl = "";

    if (useSSL) {
        fullLoginUrl = "https://" + hostName + ":" + httpPort + "/names.nsf?Login";
    } else {
        fullLoginUrl = "http://" + hostName + ":" + httpPort + "/names.nsf?Login";
    }

    DominoHttpRequest dominoRequest = DominoHttpClient.getInstance()
            .createRequest();
    dominoRequest.setUrl(fullLoginUrl);
    dominoRequest.setMethod("POST");
    dominoRequest.addParam("username", notesName);
    dominoRequest.addParam("password", notesPassword);
    dominoRequest.addParam("redirectto", "/icons/ecblank.gif");
    dominoRequest.execute();
    }

:

  • , .
  • names.nsf , .
  • . 80 http 443 https, Domino.

... Java-, "" Domino: DiscussionReplicator.java. getAuthenticationToken, "DominoAuthSessID = xyz", "LtpaToken = abc"

+1

All Articles