in reply to Creating SOAP client to pass data to Java

After having invoked SOAP::Transport::HTTP::CGI->handle(), all is over. Your CGI initialization doesn't do anything.

Then, you don't pass a CGI object to your emailfind::findingit method, which is OK, since you won't get a CGI object initialized anyways. Despite the CGI in the name, the SOAP::Transport::HTTP::CGI package doesn't use CGI and munges headers and POST params otherwise ('tis all LWP::* stuff).

I haven't found a way yet to set a cookie via a SOAP client request, but the following rewrite might take you a bit further.

Server code:

#!/usr/bin/perl use SOAP::Transport::HTTP; SOAP::Transport::HTTP::CGI->dispatch_to("emailfind")->handle; package emailfind; use HTTP::Cookies; sub findingit { warn "****** findingit(".join(',',map{"'$_'"}@_).")\n"; my $function = shift; my $cookiejar = shift; die "No cookies" unless $cookiejar; my $cookie = $cookiejar->as_string(); die "no cookie" if (!$cookie || $cookie =~ /WALOGIN="RESET/); #ex +it function if cookie empty or is RESET my ($e) = $cookie =~ /WALOGIN="([^"]+)"/; return $e; }

Client code:

#!/usr/bin/perl use warnings; use SOAP::Lite; use HTTP::Cookies; my $cookie = HTTP::Cookies->new(); $cookie->set_cookie(undef,'WALOGIN','foo@bar.com','/','localhost',80,1 +,1,100,0); my $soap = SOAP::Lite -> uri('http://localhost/emailfind') -> proxy( 'http://localhost/cgi-bin/soapdish2.pl', ); my $res = $soap->findingit($cookie); print $res->result,"\n";

Note that you don't call fault on your $soap object, but on the result object of the SOAP call - otherwise "fault" would be dispatched as a XML RPC call to the soap server.

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Replies are listed 'Best First'.
Re^2: Creating SOAP client to pass data to Java
by Anonymous Monk on Jan 03, 2008 at 14:02 UTC
    Thanks for this Shmem, I'll keep working on it once I've got past the failed access to the class error which trace is bringing up.