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 7859203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T21:49:04+00:00 2026-06-02T21:49:04+00:00

I am trying to access web services through Java in a Google Web Application

  • 0

I am trying to access web services through Java in a Google Web Application Project that i created.

The code is supposed to hit the endpoint URL and authenticate the user via the username/password and fetch the jsessionID that the server provides in a cookie. The authentication works fine but I am unable to extract the JsessionID from the cookie.

Following is the code I am using :-

private static String getCookieFromHeaders(HttpURLConnection wsConnection) {

    String headerName;
    String headerValue = "FAIL";
    for (int i = 0;; i++) {
        headerName = wsConnection.getHeaderFieldKey(i);
        if (headerName != null && headerName.equals("Set-Cookie")) {
            headerValue = wsConnection.getHeaderField(i);
            break;
        }
    }
    // return the header value (FAIL string for not found)
    return headerValue;
}

variable headerName is just giving “null” in an infinite loop.

Please advise, a complete Java noob here.

  • 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-02T21:49:08+00:00Added an answer on June 2, 2026 at 9:49 pm

    actually the cookie was being received, the header was “set-cookie” instead of “Set-Cookie”.
    Just couldn’t spot it because of the stupid infinite loop!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to access Folder from Document Library using web services in C#.
I'm trying to access an HTTPS based web service URL from a web/ear application
I am trying to implement a web service that uses open JPA to access
Trying to figure out how to programmatically access the web pages in the application.
I am trying to access a WCF web service, that is using two way
I have a web application that accesses a database through a wcf service. The
I'm having an issue trying to access a web service through Delphi. I've consumed
I am trying to develop some RESTful web services which have to access some
I'm trying to upgrade a legacy .NET remoting web services project to .NET 4.0
I am trying to write a module for a Java application that accesses a

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.