Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

SOAP::Transport::TCP connection problems

by jwest (Friar)
on Sep 18, 2001 at 20:24 UTC ( #113151=perlquestion: print w/replies, xml ) Need Help??
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 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 ./ line 12

And any subsequent connection attempts yield:

Transport endpoint is not connected at ./ 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?



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

Replies are listed 'Best First'.
Re: SOAP::Transport::TCP connection problems
by derby (Abbot) on Sep 18, 2001 at 21:59 UTC

    Your code worked fine for me. Try adding

    use SOAP::Lite +trace => qw( all );
    to both the server and client to get some additional insight.


Re: SOAP::Transport::TCP connection problems
by jwest (Friar) on Sep 18, 2001 at 22:40 UTC
    So, having taken the suggestions of both tye and derby, I found the following:

    First, I stepped through the server using the Perl debugger. To my bemusement, the code worked flawlessly, and I got the results I expected.

    Following that, I ran the code again without the debugger, and got the results reported previously.

    Then I added the use SOAP::Lite +trace => qw( all ); lines to the code above, and received the following complaint from the server:

    SOAP::Serializer::envelope: Client Application failed during request deserialization:
    no element found at line 1, column 0, byte -1 at /usr/lib/perl5/XML/ line 185

    Out of curiousity, I ran it through the debugger again with the new changes, and it works without err. At this point, I'm inclined to abandon my cause in favor of using SOAP::Transport::HTTP instead of pursuing this problem further.

    Thanks, all


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

      Your code works for me (win98, Perl5.6.1), but there is a small (already fixed) problem in handling EWOULDBLOCK for non-blocking IO that may produce the results you're having. I'm not sure about the reason though, because I can't reproduce this error. Would you try with older version of SOAP::Lite (it has blocking IO)? Thanks.

      Best wishes, Paul.

        Heya, Paul-

        Thanks for another verification of my sanity. ;) I pulled SOAP::Lite version 0.50 down from the CPAN and re-ran the tests, and it worked without err. Looks like you may very well be on the right track. Let me know if there's any other info that I can provide to you that will let you confirm your suspicions.



        -><- -><- -><- -><- -><-
        All things are Perfect
            To every last Flaw
            And bound in accord
                 With Eris's Law
         - HBT; The Book of Advice, 1:7
(tye)Re: SOAP::Transport::TCP connection problems
by tye (Sage) on Sep 18, 2001 at 21:17 UTC

    Sounds like connecting from your client is killing the server (it is at least causing the server to close the socket). You need to log any errors reported by the server and then check what those are.

            - tye (but my friends call me "Tye")

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://113151]
Approved by root
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2017-01-22 16:54 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (188 votes). Check out past polls.