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