Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8056319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:40:04+00:00 2026-06-05T08:40:04+00:00

I am trying to access QC 11 using Rest api in Java. I am

  • 0

I am trying to access QC 11 using Rest api in Java.

I am following API reference in the manual provided by HP.
Following is basic step for login authentication.

Non-Web Application Authorization Client queries the is-authenticated resource and sends no authentication headers. This
step is optional.

GET /qcbin/rest/is-authenticated

Server refuses request and returns reference to authentication point.

HTTP/1.1 401 Unauthorized WWW-Authenticate: LWSSO
realm=http://[server]:[port]/qcbin/authentication-point

Client sends a valid Basic Authentication header to the authentication
point.

GET /qcbin/authentication-point/authenticate Authorization: Basic
ABCDE123

Server validates the Basic authentication headers, creates a new
LW-SSO token and returns it as LWSSO_COOKIE_KEY.

HTTP/1.1 200 OK Set-Cookie: LWSSO_COOKIE_KEY={cookie}

The application can now access data and services using the token. At
the end of the session, log off to discard the token.

Here is my java code.

DefaultHttpClient httpClient = new DefaultHttpClient();

            String encoding = Base64.encodeBase64String("demoUser:demoUser123".getBytes());
            HttpGet httpGet = new HttpGet("http://HOST_VALUE:PORT_VALUE/qcbin/authentication-point/authenticate");
            //httpGet.setHeader("GET", "/qcbin/authentication-point/authenticate");
            httpGet.setHeader("Authorization:", "Basic " + encoding);
            HttpResponse response;



            httpClient.getCredentialsProvider().setCredentials(
                    new AuthScope("proxyHost", 8080),
                    new UsernamePasswordCredentials("userName", "Password"));




            response = httpClient.execute(httpGet);


            System.out.println(response.getAllHeaders().toString());
            System.out.println(response.getStatusLine().toString());
            BufferedReader br = new BufferedReader(
                    new InputStreamReader((response.getEntity().getContent())));

            String output;
            System.out.println("Output from Server .... \n");
            while ((output = br.readLine()) != null) {
                System.out.println(output);
            }
            httpClient.getConnectionManager().shutdown();

It gives me output as

[Lorg.apache.http.Header;@159e154 HTTP/1.1 400 Bad Request Output from
Server ….

I am new to REST by using Java. Can anyone help?
Any examples for connecting to ALM using REST and fetching data?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T08:40:05+00:00Added an answer on June 5, 2026 at 8:40 am

    Solved the problem.

    The problem was in base64 encoding !
    If you are converting string to base64 encoded string… if result is greater than 76 char. it adds new line !
    even if its less than 76

    So solution was

    encoding = encoding.replaceAll("\n", "");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to access the REST Disqus API using the following url: http://disqus.com/api/3.0/threads/listPosts.json ?api_key=myKey
I'm currently trying to access a REST API for the first time using visual
I have a REST API that I am trying to access using Rails 3.0.1
I'm trying to access rest service using ajax. If I'll paste this link on
I'm trying to access $a using the following example: df<-data.frame(a=c(x,x,y,y),b=c(1,2,3,4)) > df a b
I'm trying to access a SOAP API using Suds. The SOAP API documentation states
Given: I'm trying to create a REST API using ASP.NET MVC . I'm using
I'm trying to access an OAuth-protected resource on Google App Engine using a Java/Groovy
I'm trying to build a REST api(using Restler) which takes in username and password
I am trying access a REST API. I can get it working in Curl/REST

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.