ActiveWorks/AutoInvoke/Server.pm untested

filter: Statementstmt 0.0% 0 / 59 Branchbran 0.0% 0 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 84 CC 9 SCAR 40.0
CC
9
Cov
0%
auto_invoke
90.0
BEGIN
2.0
BEGIN
2.0
CRAP 54.8
1 package SOAP::Transport::ActiveWorks::AutoInvoke::Server;
2 use base qw( Exporter );
3  
4  
5 BEGIN
6 {
7  
8 use strict;
9 use vars qw ( $VERSION @EXPORT );
10  
11 $VERSION = '0.25';
12  
13 require 5.000;
14  
15 @EXPORT = qw ( auto_invoke );
16  
17 use Data::Dumper;
18  
19 }
20  
21  
22  
23 sub auto_invoke
24 {
25 my ($request_class, $headers, $body, $envelopeMaker) = @_;
26 my (@ARGV, $arg);
27  
28  
29 return unless ( exists $body->{_is_soap_autoload} );
30  
31 eval "require $request_class";
32 return if ($@);
33  
34 my $method_name = $body->{soap_typename};
35  
36 #
37 # Unload Arguments into an array to pass to or method
38 #
39 $arg = 0;
40 while ( $_ = $body->{"ARG$arg"} ) {
41 if ( /^_soap_array::/ ) {
42 s/^_soap_array:://;
43 $_ = eval ( $_ );
44 }
45 push ( @ARGV, $_ );
46 delete ( $body->{"ARG$arg"} );
47 $arg++;
48 }
49  
50  
51 #
52 # Recycle @ARGV with result of our method call.
53 #
54 my $rq;
55 if ( $body->{_soap_new_method} ) {
56 my $new = $body->{_soap_new_method};
57  
58 return unless ( $request_class->can ( $new ) );
59  
60 if ( $body->{NewARG0} ) {
61 my @NewARGV;
62 $arg = 0;
63 while ( $_ = $body->{"NewARG$arg"} ) {
64 if ( /^_soap_array::/ ) {
65 s/^_soap_array:://;
66 $_ = eval ( $_ );
67 }
68 push ( @NewARGV, $_ );
69 delete ( $body->{"ARG$arg"} );
70 $arg++;
71 }
72 $rq = $request_class->$new ( @NewARGV );
73 }
74 else {
75 $rq = $request_class->$new ();
76 }
77 }
78 else {
79 $rq = $request_class;
80 }
81 @ARGV = $rq->$method_name ( @ARGV );
82  
83 #
84 # Reload Arguments into an array to return to our caller
85 #
86 $arg = 0;
87 foreach (@ARGV) {
88 if ( ref ($_) eq "ARRAY" ) {
89 $_ = Dumper ( $_ );
90 s/^\$VAR = /_soap_array::/g;
91 }
92 $body->{"ARG$arg"} = $_;
93 $arg++;
94 }
95  
96 #
97 # For some reason I feel compelled to do this..
98 #
99 $body->{ARGC} = scalar @ARGV;
100  
101  
102 $envelopeMaker->set_body(undef, "$method_name.response", 0, $body);
103 }
104  
105  
106  
107 1;
108  
109 __END__