Loading ...
Sorry, an error occurred while loading the content.

Re: [soaplite] cookie problems

Expand Messages
  • Alasdair Allan
    ... Have a look at my example cookie code here http://www.astro.ex.ac.uk/people/aa/software/cookie_daemon.tar.gz Cheers, Al. -- Dr. A. Allan, School of
    Message 1 of 5 , Feb 25, 2004
    • 0 Attachment
      > I am having problems either sending or receiving cookies with
      > SOAP::Lite, but I don't know where the problem is.

      Have a look at my example cookie code here

      http://www.astro.ex.ac.uk/people/aa/software/cookie_daemon.tar.gz

      Cheers,
      Al.
      --
      Dr. A. Allan, School of Physics, University of Exeter
    • Eric Freed
      I take it back. Having your working code helped me to see what was not happening, and where it wasn t. I was right, my client was not sending cookies, and it
      Message 2 of 5 , Feb 25, 2004
      • 0 Attachment
        I take it back. Having your working code helped me to see what was not
        happening, and where it wasn't.

        I was right, my client was not sending cookies, and it turned out to be
        that my $endpoint has to be a fully qualified name:

        for example:
        my $endpoint = 'http://machinename/test';
        my $uri = URI->new($endpoint);
        my $cookie = make_cookie( "user", "password" );

        my $cookie_jar = HTTP::Cookies->new();
        $cookie_jar->set_cookie(0, user => $cookie, '/', $uri->host(),
        $uri->port());

        my $soap = SOAP::Lite
        -> readable(1)
        -> uri('http://machinename/test/SOAP') # .pm location
        -> proxy($endpoint, cookie_jar => $cookie_jar );

        $result = $soap->$method;

        will not attach a cookie, but :

        my $endpoint = 'http://machinename.domain.com/test';

        will.

        I don't know why that is, and I suspect it is a HTTP::Cookies thing and
        not SOAP::Lite, but thanks

        -Eric

        On Wed, 2004-02-25 at 14:59, Eric Freed wrote:
        > Thanks,
        >
        > I actually already found your examples (via Google), but they have not
        > helped me (or they have not helped me with *this* problem, they were
        > helpful otherwise).
        >
        > Eric

        On Wed, 2004-02-25 at 14:49, Alasdair Allan wrote:
        > > I am having problems either sending or receiving cookies with
        > > SOAP::Lite, but I don't know where the problem is.
        >
        > Have a look at my example cookie code here
        >
        > http://www.astro.ex.ac.uk/people/aa/software/cookie_daemon.tar.gz
        >
        > Cheers,
        > Al.
        --
        Eric Freed <efreed@...>
      • Alasdair Allan
        ... Yes, I ve come across this problem as well. I did spend some time trying to figure out why this was the case but I eventually gave it up as a bad job. I
        Message 3 of 5 , Feb 25, 2004
        • 0 Attachment
          > I was right, my client was not sending cookies, and it turned out to be
          > that my $endpoint has to be a fully qualified name:
          >
          > my $endpoint = 'http://machinename/test';
          >
          > will not attach a cookie, but :
          >
          > my $endpoint = 'http://machinename.domain.com/test';
          >
          > will. I don't know why that is, and I suspect it is a HTTP::Cookies
          > thing and not SOAP::Lite, but thanks

          Yes, I've come across this problem as well. I did spend some time trying
          to figure out why this was the case but I eventually gave it up as a bad
          job. I should probably add that into the cookie_dameon documentation...

          Al.
        • Byrne Reese
          This has for so many people been a point of confusion about cookies... and not just for SOAP::Lite, but for web developers in general. According to Netscape s
          Message 4 of 5 , Feb 25, 2004
          • 0 Attachment
            This has for so many people been a point of confusion about cookies... and not just for SOAP::Lite, but for web developers in general.

            According to Netscape's Cookie specification (http://wp.netscape.com/newsref/std/cookie_spec.html), the domain a cookie is appied to MUST have at least two decimals within it.

            Excerpt:
            domain=DOMAIN_NAME

            Only hosts within the specified domain can set a cookie for a domain and domains must have at least two (2) or three (3) periods in them to prevent domains of the form: ".com", ".edu", and "va.us". Any domain that fails within one of the seven special top level domains listed below only require two periods. Any other domain requires at least three. The seven special top level domains are: "COM", "EDU", "NET", "ORG", "GOV", "MIL", and "INT".

            Therefore most HTTP clients will often not set a cookie for an application deployed to "http://localhost/" for example... So if  you are doing test development, it is always advised that you create some virtualhosts like "http://test.localhost/"

            Anyway - that is why some cookies work and others don't.

            Eric Freed wrote:
            for example:
                my $endpoint = 'http://machinename/test';

            will not attach a cookie, but :

                my $endpoint = 'http://machinename.domain.com/test';

            will.

            I don't know why that is, and I suspect it is a HTTP::Cookies thing and
            not SOAP::Lite, but thanks

            -Eric

            On Wed, 2004-02-25 at 14:59, Eric Freed wrote:
            > Thanks,
            >
            > I actually already found your examples (via Google), but they have not
            > helped me (or they have not helped me with *this* problem, they were
            > helpful otherwise).
            >
            > Eric

            On Wed, 2004-02-25 at 14:49, Alasdair Allan wrote:
            > > I am having problems either sending or receiving cookies with
            > > SOAP::Lite, but I don't know where the problem is.
            >
            > Have a look at my example cookie code here
            >
            >   http://www.astro.ex.ac.uk/people/aa/software/cookie_daemon.tar.gz
            >
            > Cheers,
            > Al.
            --
            Eric Freed <efreed@...>

          Your message has been successfully submitted and would be delivered to recipients shortly.