http://www.perlmonks.org?node_id=786984


in reply to Debugging Cookies

use SOAP::Lite +trace => 'debug';
SOAP::Trace

Replies are listed 'Best First'.
Re^2: Debugging Cookies
by srleapline (Initiate) on Aug 10, 2009 at 15:58 UTC

    I've tried the SOAP::Lite +trace and it does give some info but I'm looking for more on WHY my response does not include the cookie that was provided. This is a snippet of the session. Notice that the response does NOT include the cookie. Can I adjust the debug/trace level to show more debugging info? The DOC doesn't indicate that I can. I also included the small script that I'm using to test. (This is a Windows box.)

    use SOAP::Lite +trace=>"debug"; # troubleshoot: append: +tr +ace=>"debug"; import SOAP::Data 'name'; # to set data values (q.v.) use HTTP::Cookies; # server uses client cookie for auth use Data::Dumper; # Command-line parameters: <NS IP> <username> <password> my $NS = shift @ARGV; $NS = "localhost" if (!$NS); my $username = shift @ARGV; $username = "xxxxx" if (!$username); my $password = shift @ARGV; $password = "xxxxx" if (!$password); # Cookie object. Server sends cookie for client authentication. my $cookies = HTTP::Cookies->new(ignore_discard => 1, hide_cookie2 => +1); # Create the soap object my $soap = SOAP::Lite # service URI and cookie object -> proxy("http://$NS/soap", cookie_jar=>$cookies) ; # Log on print "login: "; my $result = $soap->login( name('username'=>$username), name('password'=>$password) ) ->result; print $result->{'message'} . "\n"; # Logout print "logout: "; $result = $soap->logout()->result; print $result->{'message'} . "\n";
    <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http:/ +/www.w3.or g/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/s +oap/encodi ng/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle=" +http://sch emas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.or +g/soap/env elope/"><soap:Body><login><username xsi:type="xsd:string">xxxxx</usern +ame><pass word xsi:type="xsd:string">xxxxx</password></login></soap:Body></soap: +Envelope > SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK Connection: close Date: Mon, 10 Aug 2009 15:38:43 GMT Server: Apache Content-Length: 622 Content-Type: text/xml; charset=utf-8 Last-Modified: Mon, 10 Aug 2009 15:38:43 GMT Client-Date: Mon, 10 Aug 2009 15:38:43 GMT Client-Peer: 10.22.198.26:80 Client-Response-Num: 1 Set-Cookie: NSAPI=##93D4423CAB0A68B94B6FB6D51F05CF963883EFEC3C958CF6F6 +DEFA71A008 ;Domain=pns-pfsc-l93a;Path=/soap Status: 200 OK <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-EN +V="http:// schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xml +soap.org/s oap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" x +mlns:xsd=" http://www.w3.org/2001/XMLSchema" xmlns:ns="urn:NSConfig"><SOAP-ENV:He +ader></SOA P-ENV:Header><SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xml +soap.org/s oap/encoding/" id="_0"><ns:loginResponse><return xsi:type="ns:simpleRe +sult"><rc xsi:type="xsd:unsignedInt">0</rc><message xsi:type="xsd:string">Done</ +message></ return></ns:loginResponse></SOAP-ENV:Body></SOAP-ENV:Envelope> login: Done SOAP::Transport::HTTP::Client::send_receive: POST http://pns-pfsc-l93a +/soap HTTP /1.1 Accept: text/xml Accept: multipart/* Accept: application/soap User-Agent: SOAP::Lite/Perl/0.65_3 Content-Length: 392 Content-Type: text/xml; charset=utf-8; charset=utf-8 SOAPAction: "#logout"
      WHY my response does not include the cookie that was provided. This is a snippet of the session. Notice that the response does NOT include the cookie.

      Isn't Set-Cookie: NSAPI=##93D4423CAB0A68B94B6FB6D51F05CF963883EFEC3C958CF6F6DEFA71A008;Domain=pns-pfsc-l93a;Path=/soap the cookie?

      Maybe you can include a small server test script to go along with your client.

        The "Set-Cookie" is coming from the server. My client isn't sending it back on the next request.