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

jwest has asked for the wisdom of the Perl Monks concerning the following question:

In the process of introducing myself to SOAP, I downloaded SOAP::Lite and coded up a tiny client and server to test the functionality - I wanted to be sure I could get the basics to work before I integrated it in my main code tree. The code that follows is verbatim the code I'm using as my initial test, followed by a description of the problems that result. I'll start with the code I'm working with- first the daemon, then the module I'm requesting, and finally the client. All three of these listings are, of course, in separate files on my machine, and all of them live in the directory described in the daemon's dispatch_to call.

# daemon use warnings; use strict; use SOAP::Transport::TCP; my $daemon = SOAP::Transport::TCP::Server -> new (LocalAddr => 'localhost', LocalPort => 2323, Listen => 5, Re +use => 1) -> dispatch_to('/home/jwest/stest') ; print "Daemon established at ", join(':', $daemon->sockhost, $daemon-> +sockport), "\n"; $daemon->handle; __END__
package Foo; use warnings; use strict; sub bar { "baz!\n"; } 1; __END__
# client use warnings; use strict; use SOAP::Lite; my $soap = SOAP::Lite ->uri("tcp://localhost/Foo") ->proxy("tcp://localhost:2323") ; my $res = $soap->bar(); if ($res->fault) { print "What we have here is a failure to communicate...\n"; print $res->faultstring; } else { print $res->result; } __END__

The daemon appears to start normally, bound to 127.0.0.1:2323 as expected. It shows up in netstat, and I can telnet to it and it kicks back all sorts of good XML stuff, telling me that it can't find any XML in my request. Cool.

The client yields the following error message:

Connection reset by peer at ./client.pl line 12

And any subsequent connection attempts yield:

Transport endpoint is not connected at ./client.pl line 12

until the daemon is killed off and restarted. The daemon during all this time doesn't die off, put a message on STDOUT or STDERR, or do anything remotely interesting, at least on the surface. The client only gives off the messages as above. What's most notable is that it also doesn't give off the "failure to communicate" bit, either. I can state with a significant degree of certainty that it's not a proper SOAP fault for that reason.

I have made this code work using SOAP::Transport::HTTP - which for a normal, right-thinking person would be enough, and they'd get over the TCP implementation not working.
The code itself is fairly close to some of the example code distributed with SOAP::Lite - of which I'm using the latest, version 0.51, by the by. This is my first attempt versus SOAP, so let me know if I've made a glaring error or twenty. Otherwise, has anyone else experienced this problem, or can you duplicate it to verify that it's not just some esoteric detail of my setup?

Thanks!

--jwest


-><- -><- -><- -><- -><-
All things are Perfect
    To every last Flaw
    And bound in accord
         With Eris's Law
 - HBT; The Book of Advice, 1:7