[Catalyst-commits] r7549 - in Catalyst-Controller-SOAP/1.0/trunk: lib/Catalyst/Action/SOAP lib/Catalyst/Controller t

ruoso at dev.catalyst.perl.org ruoso at dev.catalyst.perl.org
Wed Apr 2 16:10:19 BST 2008


Author: ruoso
Date: 2008-04-02 16:10:18 +0100 (Wed, 02 Apr 2008)
New Revision: 7549

Modified:
   Catalyst-Controller-SOAP/1.0/trunk/lib/Catalyst/Action/SOAP/DocumentLiteralWrapped.pm
   Catalyst-Controller-SOAP/1.0/trunk/lib/Catalyst/Controller/SOAP.pm
   Catalyst-Controller-SOAP/1.0/trunk/t/PostApp.t
Log:
[C-C-SOAP] Tests for Document/Literal-Wrapped working. Supports several wsdls and schemas in the config.

Modified: Catalyst-Controller-SOAP/1.0/trunk/lib/Catalyst/Action/SOAP/DocumentLiteralWrapped.pm
===================================================================
--- Catalyst-Controller-SOAP/1.0/trunk/lib/Catalyst/Action/SOAP/DocumentLiteralWrapped.pm	2008-04-02 14:54:42 UTC (rev 7548)
+++ Catalyst-Controller-SOAP/1.0/trunk/lib/Catalyst/Action/SOAP/DocumentLiteralWrapped.pm	2008-04-02 15:10:18 UTC (rev 7549)
@@ -23,7 +23,7 @@
 
       die 'SOAP Action does not map to any operation' unless $action;
 
-      $c->dispatch($action);
+      $c->forward($operation);
   }
 };
 

Modified: Catalyst-Controller-SOAP/1.0/trunk/lib/Catalyst/Controller/SOAP.pm
===================================================================
--- Catalyst-Controller-SOAP/1.0/trunk/lib/Catalyst/Controller/SOAP.pm	2008-04-02 14:54:42 UTC (rev 7548)
+++ Catalyst-Controller-SOAP/1.0/trunk/lib/Catalyst/Controller/SOAP.pm	2008-04-02 15:10:18 UTC (rev 7549)
@@ -8,7 +8,7 @@
 
     use constant NS_SOAP_ENV => "http://schemas.xmlsoap.org/soap/envelope/";
 
-    our $VERSION = '0.4';
+    our $VERSION = '0.5';
 
     __PACKAGE__->mk_accessors qw(wsdlobj decoders encoders);
 
@@ -17,9 +17,28 @@
 
         my $wsdlfile = $self->config->{wsdl};
         if ($wsdlfile) {
-            $self->wsdlobj(XML::Compile::WSDL11->new($wsdlfile))
-              unless $self->wsdlobj;
+            if (!$self->wsdlobj) {
+                my $schema;
+                if (ref $wsdlfile eq 'HASH') {
+                    $schema = $wsdlfile->{schema};
+                    $wsdlfile = $wsdlfile->{wsdl};
+                }
 
+                if (ref $wsdlfile eq 'ARRAY') {
+                    my $main = shift @{$wsdlfile};
+                    $self->wsdlobj(XML::Compile::WSDL11->new($main));
+                    $self->wsdlobj->addWsdl($_) for @{$wsdlfile};
+                } else {
+                    $self->wsdlobj(XML::Compile::WSDL11->new($wsdlfile));
+                }
+
+                if (ref $schema eq 'ARRAY') {
+                    $self->wsdlobj->importDefinitions($_) for @{$schema};
+                } elsif ($schema) {
+                    $self->wsdlobj->importDefinitions($schema)
+                }
+            }
+
             my $operation = $self->wsdlobj->operation($name)
               or die 'Every operation should be on the WSDL when using one.';
             my $portop = $operation->portOperation();
@@ -313,6 +332,14 @@
 structure as returned by XML::Compile according to the type defined in
 the WSDL message.
 
+You can define additional wsdl files or even additional schema
+files. If $wsdl is an arrayref, the first element is the one passed to
+new, and the others will be the argument to subsequent addWsdl calls.
+If $wsdl is a hashref, the "wsdl" key will be handled like above and
+the "schema" key will be used to importDefinitions. If the content of
+the schema key is an arrayref, it will result in several calls to
+importDefinition.
+
 Also, when using wsdl, you can also define the response using
 
 =over

Modified: Catalyst-Controller-SOAP/1.0/trunk/t/PostApp.t
===================================================================
--- Catalyst-Controller-SOAP/1.0/trunk/t/PostApp.t	2008-04-02 14:54:42 UTC (rev 7548)
+++ Catalyst-Controller-SOAP/1.0/trunk/t/PostApp.t	2008-04-02 15:10:18 UTC (rev 7549)
@@ -92,7 +92,7 @@
     $ENV{REQUEST_METHOD} ='POST';
     $ENV{SERVER_PORT} ='80';
     $ENV{SERVER_NAME} ='pitombeira';
-    $ENV{SOAPAction} = 'http://example.com/actions/Greet';    
+    $ENV{HTTP_SOAPAction} = 'http://example.com/actions/Greet';    
 
     my ($writer, $reader, $error) = map { gensym() } 1..3;
     my $pid = open3($writer, $reader, $error,




More information about the Catalyst-commits mailing list