/[cvs]/nfo/perl/libs/OEF/Component/WebService/RpcXml.pm
ViewVC logotype

Annotation of /nfo/perl/libs/OEF/Component/WebService/RpcXml.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Fri Apr 4 17:28:15 2003 UTC (21 years, 3 months ago) by joko
Branch: MAIN
Changes since 1.1: +24 -12 lines
starting the *session* server/service from here

1 joko 1.2 ## ------------------------------------------------------------------------
2     ## $Id: WebService.pm,v 1.1 2003/03/27 15:41:27 joko Exp $
3     ## ------------------------------------------------------------------------
4     ## $Log: WebService.pm,v $
5     ## Revision 1.1 2003/03/27 15:41:27 joko
6     ## initial commit, code from daemon-api-admin.pl
7     ##
8     ## ------------------------------------------------------------------------
9 joko 1.1
10    
11     package OEF::Component::WebService;
12    
13     use strict;
14     use warnings;
15    
16     # this actually supplies the method 'new' for this package
17     use base qw( DesignPattern::Object );
18    
19     use Data::Dumper;
20     use RPC::XML;
21 joko 1.2 use RPC::XML::SessionServer;
22 joko 1.1 use RPC::XML::Procedure;
23    
24 joko 1.2 # this is a global counter for giving unnamed webservices a unique id
25     our $instance_counter;
26    
27    
28 joko 1.1 sub start {
29    
30     my $self = shift;
31    
32     # notice
33 joko 1.2 print "Starting WebService listening on port $self->{ws_port}, using main API from Package $self->{api_module}.", "\n";
34 joko 1.1
35     # trace
36     #print Dumper($self);
37     #exit;
38    
39 joko 1.2 $instance_counter++;
40    
41 joko 1.1 # here goes the server instance
42 joko 1.2 $self->{_daemon} = RPC::XML::SessionServer->new(
43     port => $self->{ws_port},
44     path => $self->{ws_path} || 'WebService' . $instance_counter,
45 joko 1.1 auto_updates => 1,
46 joko 1.2 authentication => {
47     type => 'plain',
48     user => 'hello',
49     pass => '123',
50     }
51 joko 1.1 );
52    
53     # API
54     # load api module
55     my $api = DesignPattern::Object->fromPackage($self->{api_module}) or die("Could not load Api-Module '$self->{api_module}'.");
56     # build complete bunch of api declaration metadata handling recursive plugin declaration and stuff ...
57     #$api->build([qw( OEF::YAA::API::Jobs )]);
58     $api->build($self->{api_submodules});
59     # get it!
60     my $procs = $api->getApiMetadata() or die("Could not load Api-Declarations from '$self->{api_module}'.");
61     # ... and propagate metadata for each method to daemon instance which is not yet running
62     foreach my $proc (@{$procs}) {
63     $self->{_daemon}->add_method($proc);
64     }
65    
66     # run service / activate instance
67     # Never returns...
68     $self->{_daemon}->server_loop;
69    
70     }
71    
72     1;
73     __END__

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed