Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: SOAP::Lite in Windows

by particle (Vicar)
on Jul 29, 2003 at 12:36 UTC ( [id://278804]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: SOAP::Lite in Windows
in thread SOAP::Lite in Windows

tk is not the problem. i took your example code and recreated your problem in my win2000 environment. as for creating a good example of the problem, well done! that made this problem easy for me to track down. i wish all my developers could boil their problems down to a examples this small.

back to the problem at hand. two small changes will fix this right up--one on the server, and one on the client.

here is my modified client. notice i modified the uri to point to a valid urn. this is very important--the urn is relative to the host, so absolute path really screws it up. in fact, i'm surprised it resolved it at all! there should probably be better error checking for valid urns in SOAP::Lite, to prevent others from making this mistake as well.

#!/usr/bin/perl -w use strict; use SOAP::Lite; use Tk; my( $server, $port, $urn )= qw(localhost 3004 urn://My/Soapy); my $main= MainWindow->new; my $button= $main->Button( -text => 'go!', -command => \&get, )->pack; MainLoop; sub get { print "got: ", ## SOAP::Lite->uri('http://tako:3004/My/Soapy') SOAP::Lite->uri($urn) ->proxy("http://${server}:$port") ->testy() ->result, $/; }

okay, i lied. actually the only change you need was to the client. but as i mentioned before, i prefer dispatch_with over dispatch_to, so i've modified your server to use that style. i prefer dispatch_with both because you can set your server up with multiple urns, handled by multiple packages; and because the urn and handler are paired in a hash, they are self-documenting.

#!/usr/bin/perl -w use strict; use SOAP::Transport::HTTP; my( $server, $port, $urn, $handler )= qw(localhost 3004 urn://My/Soapy My::Soapy); SOAP::Transport::HTTP::Daemon ->new( LocalAddr => $server, LocalPort => 3004, )->dispatch_to('My::Soapy')->handle; ## )->dispatch_with({ $urn => $handler }) ->handle or die 'a horrible death!'; package My::Soapy; sub testy() { 'happy!' }

by the way, you should always test for errors on your server, even in an example script. and if you are using a perl >= 5.006, you should consider use warnings over -w.

~Particle *accelerates*

Replies are listed 'Best First'.
Re: Re^3: SOAP::Lite in Windows
by anjiro (Beadle) on Jul 30, 2003 at 01:12 UTC
    Hi Particle,

    Thanks for taking the time to help. Unfortunately, that didn't seem to work. I copy-n'-pasted your code (I'm guessing the #s in the example code are on the wrong line?), and it works perfectly on the Linux box, but on the windows I get a bunch of errors now:

    Tk::Error: 500 Can't read entity body: Unknown error at soapcl2.pl lin +e 19 Carp::croak at D:/Perl/lib/Carp.pm line 191 SOAP::Lite::__ANON__ at D:/Perl/site/lib/SOAP/Lite.pm line 2749 SOAP::Lite::call at D:/Perl/site/lib/SOAP/Lite.pm line 2873 SOAP::Lite::__ANON__ at D:/Perl/site/lib/SOAP/Lite.pm line 2841 main::get at soapcl2.pl line 19 [\&main::get] Tk callback for .button Tk::__ANON__ at D:/Perl/site/lib/Tk.pm line 228 Tk::Button::butUp at D:/Perl/site/lib/Tk/Button.pm line 111 (command bound to event)

    I fiddled around a bit, but I'm not real sure what's causing this.

    Also a question about the urn... I had ->uri('http://tako:3004/My/Soapy') because I'd been cribbing off of the SOAP::Lite Quick Start Guide - the first sample client uses that exact syntax. I'm not at all familiar with SOAP in general, so I'm a little unclear (and the docs don't help much!) on the meanings and usage of stuff like uri, urn and proxy.

    I'm curious - why use warnings rather than -w?

    Thanks a lot!

    Daniel Ashbrook

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://278804]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-04-23 23:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found