What's probably happening is that the service is coded crappily and is not handling this error gracefully. Did you try using a cookie_jar? I had a lot of problems getting that to work when I tried it, so I'll put this example (_handle_fault is from bric_soap in Bricolage, in case Sam Tregar reads this :) ):

#!/usr/bin/perl use strict; use warnings; use SOAP::Lite trace => [qw(debug)], on_fault => \&_handle_fault; import SOAP::Data 'name'; use HTTP::Cookies; my $COOKIE_FILE = '/tmp/bs-wsdl-cookies.txt'; my $WSDL_FILE = 'file:///tmp/bricolage-simpletest.wsdl'; main(); exit; sub main { my $client = SOAP::Lite->service($WSDL_FILE); # xxx: I have no idea what magic is done # to initialize things (transport), # so I end up calling login a 2nd time just to add the cookie_jar! # $client->login(name(username => 'admin'), # name(password => 'change me now!')); $client->login('admin', 'change me now!'); my $cookie_jar = HTTP::Cookies->new(ignore_discard => 1, file => $COOKIE_FILE, autosave=>1); $client->transport->cookie_jar($cookie_jar); # xxx: 2nd login # $client->login(name(username => 'admin'), # name(password => 'change me now!')), $/; $client->login('admin', 'change me now!'); # .... } # handle faults from SOAP::Lite's on_fault event sub _handle_fault { my ($soap, $r) = @_; # print out the error as appropriate if (ref $r) { if ($r->faultstring eq 'Application error' and ref $r->faultdetail and ref $r->faultdetail eq 'HASH' ) + { # this is a bric exception, the interesting stuff is in de +tail print STDERR "Call failed:\n\n", join("\n", values %{$r->faultdetail}), $/, $/; } else { print STDERR "Call failed:\n\n", $r->faultstring, $/, $/; } print STDERR "Check the Apache error log for more detail.\n"; } else { print STDERR "TRANSPORT ERROR: ", $soap->transport->status, "\ +n"; print STDERR "Check the Apache error log for more information. +\n"; } return SOAP::SOM->new(); }

I think that worked for me at least. Also, if you figure out how to only have to login once, I'd appreciate knowing how!

Maybe you should write it in Java.... I was complaining about WSDL support in Perl (generally Perl in the "enterprise") just the other day.


In reply to Re: SOAP::Lite and sessions? by ForgotPasswordAgain
in thread SOAP::Lite and sessions? by tilly

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.