[Catalyst-commits] r7721 - Catalyst-Model-SOAP/1.0/trunk/lib/Catalyst/Model

ruoso at dev.catalyst.perl.org ruoso at dev.catalyst.perl.org
Thu May 8 16:12:44 BST 2008


Author: ruoso
Date: 2008-05-08 16:12:43 +0100 (Thu, 08 May 2008)
New Revision: 7721

Modified:
   Catalyst-Model-SOAP/1.0/trunk/lib/Catalyst/Model/SOAP.pm
Log:
[C-M-SOAP] Support other message types then request-response

Modified: Catalyst-Model-SOAP/1.0/trunk/lib/Catalyst/Model/SOAP.pm
===================================================================
--- Catalyst-Model-SOAP/1.0/trunk/lib/Catalyst/Model/SOAP.pm	2008-05-08 15:12:20 UTC (rev 7720)
+++ Catalyst-Model-SOAP/1.0/trunk/lib/Catalyst/Model/SOAP.pm	2008-05-08 15:12:43 UTC (rev 7721)
@@ -110,47 +110,52 @@
         if ($style =~ /rpc/i && $use =~ /literal/i) {
             my $portop = $operation->portOperation();
 
-            my $input_parts = $wsdl_obj->find(message => $portop->{input}{message})
-              ->{part};
+            if ($portop->{input}{message}) {
+                my $input_parts = $wsdl_obj->find(message => $portop->{input}{message})
+                  ->{part};
 
-            for (@{$input_parts}) {
-                my $type = $_->{type} ? $_->{type} : $_->{element};
-                $_->{compiled_writer} = $wsdl_obj->schemas->compile
-                  (WRITER => $type, elements_qualified => 'ALL');
-            };
+                for (@{$input_parts}) {
+                    my $type = $_->{type} ? $_->{type} : $_->{element};
+                    $_->{compiled_writer} = $wsdl_obj->schemas->compile
+                      (WRITER => $type, elements_qualified => 'ALL');
+                };
 
-            my $output_parts = $wsdl_obj->find(message => $portop->{output}{message})
-              ->{part};
-            for (@{$output_parts}) {
-                my $type = $_->{type} ? $_->{type} : $_->{element};
-                $_->{compiled_reader} = $wsdl_obj->schemas->compile
-                  (READER => $type);
+                $rpcin = sub {
+                    my ($doc, $data) = @_;
+                    my $operation_element = $doc->createElement($operation->name);
+                    my @parts =
+                      map {
+                          $_->{compiled_writer}->($doc, $data->{$_->{name}})
+                      } @{$input_parts};
+                    $operation_element->appendChild($_)
+                      for grep { ref $_ } @parts;
+                    return $operation_element;
+                };
             }
 
-            $rpcin = sub {
-                my ($doc, $data) = @_;
-                my $operation_element = $doc->createElement($operation->name);
-                my @parts =
-                  map {
-                      $_->{compiled_writer}->($doc, $data->{$_->{name}})
-                  } @{$input_parts};
-                $operation_element->appendChild($_)
-                  for grep { ref $_ } @parts;
-                return $operation_element;
-            };
+            if ($portop->{output}{message}) {
+                my $output_parts = $wsdl_obj->find(message => $portop->{output}{message})
+                  ->{part};
+                for (@{$output_parts}) {
+                    my $type = $_->{type} ? $_->{type} : $_->{element};
+                    $_->{compiled_reader} = $wsdl_obj->schemas->compile
+                      (READER => $type);
+                }
 
-            $rpcout = sub {
-                my $soap = shift;
-                my @nodes = grep { UNIVERSAL::isa($_, 'XML::LibXML::Element') } @_;
-                return
-                  {
-                   map {
-                       my $data = $_->{compiled_reader}->(shift @nodes);
-                       ( $_->{name} => $data )
-                   } @{$output_parts}
-                  };
-            };
 
+                $rpcout = sub {
+                    my $soap = shift;
+                    my @nodes = grep { UNIVERSAL::isa($_, 'XML::LibXML::Element') } @_;
+                    return
+                      {
+                       map {
+                           my $data = $_->{compiled_reader}->(shift @nodes);
+                           ( $_->{name} => $data )
+                       } @{$output_parts}
+                      };
+                };
+            }
+
         }
 
         my $code = $operation->compileClient($send ? ( transport => $send ) : (),




More information about the Catalyst-commits mailing list