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

  • Home
  • SEARCH
  • 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 7037181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:30:48+00:00 2026-05-28T01:30:48+00:00

GetMessages is a method I have in a .net web service for my chat

  • 0

GetMessages is a method I have in a .net web service for my chat program. It gets a collection of messages, only sending new ones by saving the last message ID in a session variable.

HeaderProperty mSessionHeader = null;

public SoapObject GetMessages()
{
    ...
    SoapObject request = new SoapObject(NAMESPACE, METHOD);

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.V11);
    envelope.dotNet = true;
    envelope.bodyOut = request;

    HttpTransport transport = new HttpTransport(URL);
    transport.debug = true;

    // Build request header
    LinkedList<HeaderProperties> reqHeaders = new LinkList<HeaderProperties>();

    if (mSessionHeader != null) {
        reqHeaders.add(mSessionHeader); //using the session id from last header
    }

    List<HeaderProperties> respHeaders = transport.call(ACTION, envelope, reqHeaders);

    // See note after code
    for (HeaderProperty hp : respHeaders) {
        if (hp.getKey().equalsIgnoreCase("set-cookie"))
        {
            mSessionHeader = hp;
            break;
        }
    }

    return (SoapObject) envelope.getResponse();
}

the value of mSessionHeader is something like

set-cookie: ASP.NET_SessionId=0zzfwxxp1sakeafybjzsxp0k; path=/; HttpOnly

However, the GUID part changes every call to … transport.call()
When I use the same header (by putting if mSessionHeader == null around the for loop)
it still does not work… the method gets every message sent regardless of the
position i set in the Web Service

Do I have to add more headers then just the ASP.NET_SessionId?

  • 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-05-28T01:30:48+00:00Added an answer on May 28, 2026 at 1:30 am

    I’m surprised there isn’t demand for an answer to this… anyways I found it.

    The request header to send a cookie is different from the response –

    Request

    “Cookie: ASP.NET_SessionId=#####”

    Response

    “Set-Cookie: ASP.NET_SessionId=#####”

    So the above line –

    reqHeaders.add(mSessionHeader);
    

    gets changed to

    reqHeaders.add(new HeaderProperty("Cookie", mSessionHeader.getValue());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two ajax calls to a web service from jquery. The first call
I have some code that retrieves an image from the web using this method
I have following program in same file. I have synchronized the run() method. class
I have a program that will get messages from a server and store them
I am creating a chat using Ajax requests and I'm trying to get messages
HI I have a working SmsReceiver and a method that will search to contacts
I have this below proram package com; import java.io.PrintStream; import java.net.URL; import java.net.URLConnection; public
Lets say I have a WCF service that a client can use to receive
I have such code, with downloaded from i-net class for db. I'm interested, how
I have a java program that acts as a POP3 client using javax.mail. I

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.