in reply to SOAP::Lite and sessions?
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: SOAP::Lite and sessions?
by tilly (Archbishop) on Jul 23, 2007 at 17:27 UTC | |
|
Re^2: SOAP::Lite and sessions?
by Anonymous Monk on Apr 18, 2008 at 15:34 UTC | |
by polera (Initiate) on Apr 18, 2008 at 15:38 UTC | |
|
Re^2: SOAP::Lite and sessions?
by erroneousBollock (Curate) on Jul 19, 2007 at 23:17 UTC | |
by tilly (Archbishop) on Jul 23, 2007 at 17:37 UTC | |
by ForgotPasswordAgain (Vicar) on Jul 20, 2007 at 07:55 UTC |