1 |
#!/usr/bin/perl |
## ------------------------------------------------------------------------ |
|
|
|
|
## -------------------------------------------------------------------------------- |
|
2 |
## $Id$ |
## $Id$ |
3 |
## -------------------------------------------------------------------------------- |
## ------------------------------------------------------------------------ |
4 |
## $Log$ |
## $Log$ |
5 |
|
## Revision 1.3 2003/04/04 17:28:59 joko |
6 |
|
## minor update: commented hardcoded stuff |
7 |
|
## |
8 |
|
## Revision 1.2 2003/04/04 17:28:15 joko |
9 |
|
## starting the *session* server/service from here |
10 |
|
## |
11 |
## Revision 1.1 2003/03/27 15:41:27 joko |
## Revision 1.1 2003/03/27 15:41:27 joko |
12 |
## initial commit, code from daemon-api-admin.pl |
## initial commit, code from daemon-api-admin.pl |
13 |
## |
## |
14 |
## -------------------------------------------------------------------------------- |
## ------------------------------------------------------------------------ |
15 |
|
|
16 |
|
|
17 |
package OEF::Component::WebService; |
package OEF::Component::WebService; |
24 |
|
|
25 |
use Data::Dumper; |
use Data::Dumper; |
26 |
use RPC::XML; |
use RPC::XML; |
27 |
use RPC::XML::Server; |
use RPC::XML::SessionServer; |
28 |
use RPC::XML::Procedure; |
use RPC::XML::Procedure; |
29 |
|
|
30 |
|
# this is a global counter for giving unnamed webservices a unique id |
31 |
|
our $instance_counter; |
32 |
|
|
33 |
|
|
34 |
sub start { |
sub start { |
35 |
|
|
36 |
my $self = shift; |
my $self = shift; |
37 |
|
|
38 |
# notice |
# notice |
39 |
print "Starting WebService listening on port $self->{port}, using main API from Package $self->{api_module}.", "\n"; |
print "Starting WebService listening on port $self->{ws_port}, using main API from Package $self->{api_module}.", "\n"; |
40 |
|
|
41 |
# trace |
# trace |
42 |
#print Dumper($self); |
#print Dumper($self); |
43 |
#exit; |
#exit; |
44 |
|
|
45 |
|
$instance_counter++; |
46 |
|
|
47 |
# here goes the server instance |
# here goes the server instance |
48 |
$self->{_daemon} = RPC::XML::Server->new( |
$self->{_daemon} = RPC::XML::SessionServer->new( |
49 |
port => $self->{port}, |
port => $self->{ws_port}, |
50 |
#path => 'RPCSERV', |
path => $self->{ws_path} || 'WebService' . $instance_counter, |
51 |
auto_updates => 1, |
auto_updates => 1, |
52 |
|
|
53 |
|
# FIXME: this is hardcoded! |
54 |
|
authentication => { |
55 |
|
type => 'plain', |
56 |
|
user => 'hello', |
57 |
|
pass => '123', |
58 |
|
} |
59 |
); |
); |
60 |
|
|
61 |
# API |
# API |