#!perl package DemoService; use strict; use warnings; use Moose; use namespace::autoclean; has 'size',is=>'rw',default=>20; #Do it for all classes so Moose will create fast object creation, so application runs faster __PACKAGE__->meta->make_immutable(); 1; package main; use strict; use warnings; use SOAP::Transport::HTTP; use Compress::Zlib; use FindBin qw($RealBin); use lib "$RealBin"; $|=1; my $httpSoapDaemon = SOAP::Transport::HTTP::Daemon->new(LocalAddr => 'localhost',Reuse => 1,LocalPort => 8081); #Will be encrypted if message > 100 $httpSoapDaemon->options({compress_threshold => 500}); #Dispatch calls to particular class #$httpSoapDaemon-> objects_by_reference(qw(DemoService)); $httpSoapDaemon->dispatch_to(qw(DemoService)); print "\n Server started. URL: ", $httpSoapDaemon->url(); #Daemon started here $httpSoapDaemon->handle();