/[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.3 - (hide annotations)
Fri Apr 4 17:28:59 2003 UTC (21 years, 3 months ago) by joko
Branch: MAIN
Changes since 1.2: +6 -1 lines
minor update: commented hardcoded stuff

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

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