1 package FS::SelfService::XMLRPC;
5 FS::SelfService::XMLRPC - Freeside XMLRPC accessible self-service API
11 Use this API to implement your own client "self-service" module vi XMLRPC.
13 Each routine described in L<FS::SelfService> is available vi XMLRPC as the
14 method FS.SelfService.XMLRPC.B<method>. All values are passed to the
15 selfservice-server in a struct of strings. The return values are in a
16 struct as strings, arrays, or structs as appropriate for the values
17 described in L<FS::SelfService>.
23 L<freeside-selfservice-clientd>, L<freeside-selfservice-server>,L<FS::SelfService>
28 use vars qw($DEBUG $AUTOLOAD);
29 use XMLRPC::Lite; # for XMLRPC::Data
33 $FS::SelfService::DEBUG = $DEBUG;
35 #false laziness w/FS::ClientAPI_XMLRPC.pm
37 'invoice_pdf' => { 'invoice_pdf' => 'base64', },
38 'legacy_invoice_pdf' => { 'invoice_pdf' => 'base64', },
39 'skin_info' => { 'logo' => 'base64',
40 'title_left_image' => 'base64',
41 'title_right_image' => 'base64',
42 'menu_top_image' => 'base64',
43 'menu_body_image' => 'base64',
44 'menu_bottom_image' => 'base64',
46 'invoice_logo' => { 'logo' => 'base64', },
51 $call =~ s/^FS::SelfService::XMLRPC:://;
53 if (exists($FS::SelfService::autoload{$call})) {
55 shift; #discard package name;
57 $call = "FS::SelfService::$call";
61 my $return = &{$call}(@_);
63 if ( exists($typefix{$call}) ) {
64 my $typefix = $typefix{$call};
65 foreach my $field ( grep exists($return->{$_}), keys %$typefix ) {
66 my $type = $typefix->{$field};
67 $return->{$field} = XMLRPC::Data->value($return->{$field})
75 die "No such procedure: $call";
79 package SOAP::Transport::HTTP::Daemon; # yuck
81 use POSIX qw(:sys_wait_h);
83 no warnings 'redefine';
86 my $self = shift->new;
88 local $SIG{CHLD} = 'IGNORE';
91 while (my $c = $self->accept) {
95 $kid = waitpid(-1, WNOHANG);
96 warn "found kid $kid";
102 if ( not defined $pid ) {
103 warn "fork() failed: $!";
106 while (my $r = $c->get_request) {
108 $self->SUPER::handle;
109 $c->send_response($self->response);
111 # replaced ->close, thanks to Sean Meisner <Sean.Meisner@VerizonWireless.com>
112 # shutdown() doesn't work on AIX. close() is used in this case. Thanks to Jos Clijmans <jos.clijmans@recyfin.be>
113 UNIVERSAL::isa($c, 'shutdown') ? $c->shutdown(2) : $c->close();