[Catalyst-commits] r7719 - Catalyst-Controller-SOAP/1.0/trunk/lib/Catalyst/Controller

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


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

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

Modified: Catalyst-Controller-SOAP/1.0/trunk/lib/Catalyst/Controller/SOAP.pm
===================================================================
--- Catalyst-Controller-SOAP/1.0/trunk/lib/Catalyst/Controller/SOAP.pm	2008-05-08 01:40:12 UTC (rev 7718)
+++ Catalyst-Controller-SOAP/1.0/trunk/lib/Catalyst/Controller/SOAP.pm	2008-05-08 15:12:06 UTC (rev 7719)
@@ -199,50 +199,57 @@
             my $portop = $operation->portOperation();
             $c->log->debug("SOAP: @{[$operation->name]} $portop->{input}{message} $portop->{output}{message}");
 
-            my $input_parts = $self->wsdlobj->find(message => $portop->{input}{message})
-              ->{part};
-            for (@{$input_parts}) {
-                my $type = $_->{type} ? $_->{type} : $_->{element};
-                $c->log->debug("SOAP: @{[$operation->name]} input part $_->{name}, type $type");
-                $_->{compiled_reader} = $self->wsdlobj->schemas->compile
-                  (READER => $type,
-                   %$reader_opts);
-            };
+            if ($portop->{input}{message}) {
 
-            $self->decoders({}) unless $self->decoders();
-            $self->decoders->{$name} = sub {
-                my $body = shift;
-                my @nodes = grep { UNIVERSAL::isa($_, 'XML::LibXML::Element') } $body->childNodes();
-                return
-                  {
-                   map {
-                       my $data = $_->{compiled_reader}->(shift @nodes);
-                       $_->{name} => $data;
-                   } @{$input_parts}
-                  }, @nodes;
-            };
+                my $input_parts = $self->wsdlobj->find(message => $portop->{input}{message})
+                  ->{part};
+                for (@{$input_parts}) {
+                    my $type = $_->{type} ? $_->{type} : $_->{element};
+                    $c->log->debug("SOAP: @{[$operation->name]} input part $_->{name}, type $type");
+                    $_->{compiled_reader} = $self->wsdlobj->schemas->compile
+                      (READER => $type,
+                       %$reader_opts);
+                };
 
-            my $output_parts = $self->wsdlobj->find(message => $portop->{output}{message})
-              ->{part};
-            for (@{$output_parts}) {
-                my $type = $_->{type} ? $_->{type} : $_->{element};
-                $c->log->debug("SOAP: @{[$operation->name]} out part $_->{name}, type $type");
-                $_->{compiled_writer} = $self->wsdlobj->schemas->compile
-                  (WRITER => $_->{type} ? $_->{type} : $_->{element},
-                   elements_qualified => 'ALL',
-                   %$writer_opts);
+                $self->decoders({}) unless $self->decoders();
+                $self->decoders->{$name} = sub {
+                    my $body = shift;
+                    my @nodes = grep { UNIVERSAL::isa($_, 'XML::LibXML::Element') } $body->childNodes();
+                    return
+                      {
+                       map {
+                           my $data = $_->{compiled_reader}->(shift @nodes);
+                           $_->{name} => $data;
+                       } @{$input_parts}
+                      }, @nodes;
+                };
             }
 
-            $self->encoders({}) unless $self->encoders();
-            $self->encoders->{$name} = sub {
-                my ($doc, $data) = @_;
-                return
-                  [
-                   map {
-                       $_->{compiled_writer}->($doc, $data->{$_->{name}})
-                   } @{$output_parts}
-                  ];
-            };
+            if ($portop->{output}{message}) {
+
+                my $output_parts = $self->wsdlobj->find(message => $portop->{output}{message})
+                  ->{part};
+                for (@{$output_parts}) {
+                    my $type = $_->{type} ? $_->{type} : $_->{element};
+                    $c->log->debug("SOAP: @{[$operation->name]} out part $_->{name}, type $type");
+                    $_->{compiled_writer} = $self->wsdlobj->schemas->compile
+                      (WRITER => $_->{type} ? $_->{type} : $_->{element},
+                       elements_qualified => 'ALL',
+                       %$writer_opts);
+                }
+
+                $self->encoders({}) unless $self->encoders();
+                $self->encoders->{$name} = sub {
+                    my ($doc, $data) = @_;
+                    return
+                      [
+                       map {
+                           $_->{compiled_writer}->($doc, $data->{$_->{name}})
+                       } @{$output_parts}
+                      ];
+                };
+
+            }
         }
 
         my $actionclass = ($value =~ /^\+/ ? $value :




More information about the Catalyst-commits mailing list