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

In reply to SOAP::Transport::TCP connection problems by jwest

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.