WE/Server/SOAP.pm untested

filter: Statementstmt 0.0% 0 / 28 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 44 CC 1 SCAR 6.9
CC
1
Cov
0%
new
2.0
daemon
2.0
get_stored_obj
2.0
CRAP 2.0
1 # -*- perl -*-
2  
3 #
4 # $Id: SOAP.pm,v 1.6 2004/02/15 22:31:20 eserte Exp $
5 # Author: Slaven Rezic
6 #
7 # Copyright (C) 2001 Online Office Berlin. All rights reserved.
8 # Copyright (C) 2002 Slaven Rezic.
9 # This is free software; you can redistribute it and/or modify it under the
10 # terms of the GNU General Public License, see the file COPYING.
11  
12 #
13 # Mail: slaven@rezic.de
14 # WWW: http://we-framework.sourceforge.net
15 #
16  
17 package WE::Server::SOAP;
18  
19 use strict;
20 use vars qw($VERSION);
21 $VERSION = sprintf("%d.%02d", q$Revision: 1.6 $ =~ /(\d+)\.(\d+)/);
22  
23 sub new {
24 my($class, %args) = @_;
25 my $self = {Port => $args{-port}};
26 bless $self, $class;
27 }
28  
29 sub daemon {
30 my($self) = @_;
31 #use SOAP::Lite +trace => qw(objects method fault);# XXX only for debugging XXX does not work with 0.55?!
32 use SOAP::Transport::HTTP;
33 $SIG{PIPE} = 'IGNORE';
34 $SIG{INT} = sub { exit(0) };
35 my $daemon = SOAP::Transport::HTTP::Daemon
36 # if you do not specify LocalAddr then you can access it with
37 # any hostname/IP alias, including localhost or 127.0.0.1.
38 # if do you specify LocalAddr in ->new() then you can only access it
39 # from that interface. -- Michael Percy <mpercy@portera.com>
40 -> new (LocalPort => $self->{Port})
41 # you may also add other options, like 'Reuse' => 1 and/or 'Listen' => 128
42  
43 # specify list of objects-by-reference here
44 -> objects_by_reference(qw(WE_Sample::Root WE::DB WE::DB::Obj WE::DB::User WE::DB::Content))
45 ->dispatch_to('/home/e/eserte/work/WE_Framework/lib', 'WE_Sample::Root', 'WE::DB::Obj')
46 ->options({compress_threshold => 10000})
47 ;
48 print "Contact to SOAP server at ", $daemon->url, "\n";
49 $daemon->handle;
50 exit(0);
51 }
52  
53 { package WE::DB::Obj;
54 # XXX only for debugging:
55 sub get_stored_obj { shift->_get_stored_obj(@_) }
56 sub store_stored_obj { shift->_store_stored_obj(@_) }
57 }
58  
59 # XXXX so nicht: besser als DB-Pool
60 # { package WE_Sample::Root;
61 # sub get_db {
62 # my($class, $id) = @_;
63 # my $obj;
64 # if ($id eq 'sample-eserte') {
65 # $obj = WE_Sample::Root->new(-rootdir => "/home/e/eserte/public_html/sample/wwwroot/cgi-bin/we_data",
66 # -connect => 0,
67 # -locking => 1);
68 # } else {
69 # die "Unhandled id $id";
70 # }
71 # $obj;
72 # }
73 # }
74  
75 return 1 if caller();
76  
77 package main;
78  
79 my $ss = WE::Server::SOAP->new(-port => shift||8123);
80 $ss->daemon;
81  
82 __END__