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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:58:29+00:00 2026-06-16T03:58:29+00:00

It always gives me the login page, as a response, because, it doesn’t see

  • 0

It always gives me the login page, as a response, because, it doesn’t see me as logged in.
This is the code for my POST method ( i call it both on the login and other web services):

protected WebEntity sendPOST(WebServiceTask.InputParam param) throws Exception {
    WebEntity result = null;
    httppost = new HttpPost(param.url);

    if ((param.nameValuePairs != null) && !param.nameValuePairs.isEmpty()) {
        httppost.setEntity(new UrlEncodedFormEntity(param.nameValuePairs, "UTF-8"));
        LogService.log("sendPOST", "======params========" + param.nameValuePairs);
    }
    System.out.println("----blabla_session : "+blabla_session);
    if (blabla_session != null) {
        CookieStore cookieStore = httpclient.getCookieStore();
        BasicClientCookie cookie = new BasicClientCookie("blabla_session", blabla_session);
        cookie.setDomain("http://blbla.kz");
        cookieStore.addCookie(cookie);
        httpclient.setCookieStore(cookieStore);
        httppost.setHeader("Set-Cookie", blabla_session);


    }
    LogService.log("WEB-SERVER-CLIENT POST : ", httppost.getURI().toString());
    HttpResponse response = httpclient.execute(httppost);

    if (response.getStatusLine().getStatusCode() >= 400) {
        String maybeThereIsSomeExtraMessageInBody = "";
        try {
            maybeThereIsSomeExtraMessageInBody = (String) getResponseStream(response, response.getEntity(), String.class);
        } catch (Exception e) {
            e.printStackTrace();
            // DO NOTHING
        }
        return new WebEntity(response.getStatusLine().getStatusCode(), response.getStatusLine().getReasonPhrase() + "\n" + maybeThereIsSomeExtraMessageInBody);
    }
    Header cp = response.getFirstHeader("Set-Cookie");
    if(cp!=null){
        HeaderElement[] he = cp.getElements();
        for (int i = 0; i < he.length; i++) {
            if(he[i].getName().equalsIgnoreCase("blabla_session")){
                blabla_session = he[i].getValue();
                break;
            }
        }
    }
    HttpEntity responseEntity = response.getEntity();
    if (responseEntity != null) {
        if (result != null) {
            result.success = true;
        } else {
            result = new WebEntity(false);
        }
    }
    return result;
}

Now the first WS call i do, is the Login WS, at this time, blabla_session is null, so that part of the code, does not initiate. From the second WS call, the blabla_session (which is static) is initiated with the necesary session_code, i get from the session. This is why, it enters the (blabla_session != null) part of code, where it should create the cookie, to send with the WS call

This is the code they use for the WebService, i call:

r = requests.post('http://blabla.kz/api/login/',data={'username':'USERNAME','password':'123'})
rr = requests.get('http://blabla.kz/api/validate_coupon/bsdfsdfsd/', cookies=r.cookies)
rr.text
  • 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-16T03:58:30+00:00Added an answer on June 16, 2026 at 3:58 am

    When i was invoking the webservice call, i had a parameter that shouldn;t be there, in the nameValuePairs, and that is why it was crashing

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

Sidebar

Related Questions

This are few of the fundamental database questions which has always given me trouble.
Has Java always maintained source-code backward compatibility during its development? More precisely: given two
twitter api always give "Sorry, that page does not exist" error for deleted tweets
The fb android sdk doc makes this reference: However, note that this doesn't account
This is giving me quite some headache. I have an page-tab-application, where DB-interaction uses
I hope that in this post, I can get people's opinions on best practices
I wanted to add facebook login option on my website, but always getting, An
I am developing a website using ASP.NET 4.0 and SQL Server 2008.In Login Page,
I'm adding data to my listbox using this code : SqlCommand cmd1 = new
On my website I have a 'login prompt' which is visible on every page.

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.