[Catalyst-commits] r7170 - in Catalyst-Controller-SOAP/1.0/tags: . 0.0.3 0.0.3/lib/Catalyst/Action 0.0.3/lib/Catalyst/Action/SOAP 0.0.3/lib/Catalyst/Controller 0.0.3/lib/Catalyst/Controller/SOAP 0.0.3/t

ruoso at dev.catalyst.perl.org ruoso at dev.catalyst.perl.org
Tue Nov 27 10:56:42 GMT 2007


Author: ruoso
Date: 2007-11-27 10:56:42 +0000 (Tue, 27 Nov 2007)
New Revision: 7170

Added:
   Catalyst-Controller-SOAP/1.0/tags/0.0.3/
   Catalyst-Controller-SOAP/1.0/tags/0.0.3/Changes
   Catalyst-Controller-SOAP/1.0/tags/0.0.3/MANIFEST
   Catalyst-Controller-SOAP/1.0/tags/0.0.3/META.yml
   Catalyst-Controller-SOAP/1.0/tags/0.0.3/Makefile.PL
   Catalyst-Controller-SOAP/1.0/tags/0.0.3/README
   Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/
   Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Action/SOAP.pm
   Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Action/SOAP/DocumentLiteral.pm
   Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Action/SOAP/HTTPGet.pm
   Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Action/SOAP/RPCEndpoint.pm
   Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Controller/SOAP.pm
   Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Controller/SOAP/RPC.pm
   Catalyst-Controller-SOAP/1.0/tags/0.0.3/t/
   Catalyst-Controller-SOAP/1.0/tags/0.0.3/t/Catalyst-Controller-SOAP.t
   Catalyst-Controller-SOAP/1.0/tags/0.0.3/t/PostApp/
   Catalyst-Controller-SOAP/1.0/tags/0.0.3/t/lib/
Removed:
   Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Action/SOAP.pm
   Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Action/SOAP/DocumentLiteral.pm
   Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Action/SOAP/RPCEndpoint.pm
   Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Controller/SOAP.pm
   Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Controller/SOAP/RPC.pm
   Catalyst-Controller-SOAP/1.0/tags/0.0.3/t/Catalyst-Controller-SOAP.t
Log:
marking the 0.0.3 release

Copied: Catalyst-Controller-SOAP/1.0/tags/0.0.3 (from rev 7164, Catalyst-Controller-SOAP/1.0/trunk)

Copied: Catalyst-Controller-SOAP/1.0/tags/0.0.3/Changes (from rev 7165, Catalyst-Controller-SOAP/1.0/trunk/Changes)
===================================================================
--- Catalyst-Controller-SOAP/1.0/tags/0.0.3/Changes	                        (rev 0)
+++ Catalyst-Controller-SOAP/1.0/tags/0.0.3/Changes	2007-11-27 10:56:42 UTC (rev 7170)
@@ -0,0 +1,6 @@
+Revision history for Perl extension Catalyst::Controller::SOAP.
+
+0.01  Tue Nov  6 10:23:19 2007
+	- original version; created by h2xs 1.23 with options
+		-n Catalyst::Controller::SOAP
+

Copied: Catalyst-Controller-SOAP/1.0/tags/0.0.3/MANIFEST (from rev 7168, Catalyst-Controller-SOAP/1.0/trunk/MANIFEST)
===================================================================
--- Catalyst-Controller-SOAP/1.0/tags/0.0.3/MANIFEST	                        (rev 0)
+++ Catalyst-Controller-SOAP/1.0/tags/0.0.3/MANIFEST	2007-11-27 10:56:42 UTC (rev 7170)
@@ -0,0 +1,17 @@
+Changes
+Makefile.PL
+MANIFEST
+META.yml
+README
+t/Catalyst-Controller-SOAP.t
+t/lib/TestApp/Controller/WS.pm
+t/lib/TestApp/Controller/Root.pm
+t/lib/TestApp.pm
+lib/Catalyst/Action/SOAP.pm
+lib/Catalyst/Action/SOAP/DocumentLiteral.pm
+lib/Catalyst/Action/SOAP/HTTPGet.pm
+lib/Catalyst/Action/SOAP/RPCEndpoint.pm
+lib/Catalyst/Action/SOAP/RPCLiteral.pm
+lib/Catalyst/Action/SOAP/RPCEncoded.pm
+lib/Catalyst/Controller/SOAP.pm
+lib/Catalyst/Controller/SOAP/RPC.pm

Copied: Catalyst-Controller-SOAP/1.0/tags/0.0.3/META.yml (from rev 7168, Catalyst-Controller-SOAP/1.0/trunk/META.yml)
===================================================================
--- Catalyst-Controller-SOAP/1.0/tags/0.0.3/META.yml	                        (rev 0)
+++ Catalyst-Controller-SOAP/1.0/tags/0.0.3/META.yml	2007-11-27 10:56:42 UTC (rev 7170)
@@ -0,0 +1,16 @@
+--- #YAML:1.0
+name: Catalyst-Controller-SOAP
+abstract: Add SOAP features to the Catalyst Framework
+version: 0.0.1
+author:
+  - Daniel Ruoso <daniel.ruoso at verticalone.pt>
+license: perl
+distribution_type: module
+requires:
+  XML::LibXML: 0
+  Catalyst::Controller: 5.7000
+meta-spec:
+  version: 1.3
+  url: http://module-build.sourceforge.net/META-spec-v1.3.html
+resources:
+  repository: http://people.debian.org/~ruoso/Catalyst-Controller-SOAP/

Copied: Catalyst-Controller-SOAP/1.0/tags/0.0.3/Makefile.PL (from rev 7169, Catalyst-Controller-SOAP/1.0/trunk/Makefile.PL)
===================================================================
--- Catalyst-Controller-SOAP/1.0/tags/0.0.3/Makefile.PL	                        (rev 0)
+++ Catalyst-Controller-SOAP/1.0/tags/0.0.3/Makefile.PL	2007-11-27 10:56:42 UTC (rev 7170)
@@ -0,0 +1,12 @@
+use 5.008008;
+use ExtUtils::MakeMaker;
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+WriteMakefile(
+    NAME              => 'Catalyst::Controller::SOAP',
+    VERSION_FROM      => 'lib/Catalyst/Controller/SOAP.pm', # finds $VERSION
+    PREREQ_PM         => { Catalyst::Controller => 0, XML::LibXML => 0}, # e.g., Module::Name => 1.1
+    ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
+      (ABSTRACT_FROM  => 'lib/Catalyst/Controller/SOAP.pm', # retrieve abstract from module
+       AUTHOR         => 'Daniel Ruoso <daniel.ruoso at verticalone.pt>') : ()),
+);

Copied: Catalyst-Controller-SOAP/1.0/tags/0.0.3/README (from rev 7165, Catalyst-Controller-SOAP/1.0/trunk/README)
===================================================================
--- Catalyst-Controller-SOAP/1.0/tags/0.0.3/README	                        (rev 0)
+++ Catalyst-Controller-SOAP/1.0/tags/0.0.3/README	2007-11-27 10:56:42 UTC (rev 7170)
@@ -0,0 +1,40 @@
+Catalyst-Controller-SOAP version 0.01
+=====================================
+
+The README is used to introduce the module and provide instructions on
+how to install the module, any machine dependencies it may have (for
+example C compilers and installed libraries) and any other information
+that should be provided before the module is installed.
+
+A README file is required for CPAN modules since CPAN extracts the
+README file from a module distribution so that people browsing the
+archive can use it get an idea of the modules uses. It is usually a
+good idea to provide version information here so that people can
+decide whether fixes for the module are worth downloading.
+
+INSTALLATION
+
+To install this module type the following:
+
+   perl Makefile.PL
+   make
+   make test
+   make install
+
+DEPENDENCIES
+
+This module requires these other modules and libraries:
+
+  blah blah blah
+
+COPYRIGHT AND LICENCE
+
+Put the correct copyright and licence information here.
+
+Copyright (C) 2007 by Daniel Ruoso
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version 5.8.8 or,
+at your option, any later version of Perl 5 you may have available.
+
+

Copied: Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib (from rev 7165, Catalyst-Controller-SOAP/1.0/trunk/lib)

Deleted: Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Action/SOAP/DocumentLiteral.pm
===================================================================
--- Catalyst-Controller-SOAP/1.0/trunk/lib/Catalyst/Action/SOAP/DocumentLiteral.pm	2007-11-27 10:48:51 UTC (rev 7165)
+++ Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Action/SOAP/DocumentLiteral.pm	2007-11-27 10:56:42 UTC (rev 7170)
@@ -1,56 +0,0 @@
-{ package Catalyst::Action::SOAP::DocumentLiteral;
-
-  use base qw/Catalyst::Action::SOAP/;
-
-  sub execute {
-      my $self = shift;
-      my ( $controller, $c ) = @_;
-      $self->prepare_soap_helper($c);
-      $self->prepare_soap_xml_post($c);
-      unless ($c->stash->{soap}->fault) {
-          my $envelope = $c->stash->{soap}->parsed_envelope;
-          my ($body) = $envelope->getElementsByTagName('body',0);
-          $self->NEXT::execute($controller, $c, $body);
-      }
-  }
-};
-
-1;
-
-__END__
-
-=head1 NAME
-
-Catalyst::Action::SOAP::DocumentLiteral - Document Literal service
-
-=head1 SYNOPSIS
-
-  # not used directly.
-
-=head1 DESCRIPTION
-
-This action implements a simple parse of the envelope and passing the
-body to the service as a xml object.
-
-=head1 TODO
-
-Almost all the SOAP protocol is unsupported, only the method
-dispatching and, optionally, the soap-decoding of the arguments are
-made.
-
-=head1 AUTHORS
-
-Daniel Ruoso <daniel.ruoso at verticalone.pt>
-
-=head1 BUG REPORTS
-
-Please submit all bugs regarding C<Catalyst::Controller::SOAP> to
-C<bug-catalyst-controller-soap at rt.cpan.org>
-
-=head1 LICENSE
-
-This library is free software, you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-

Copied: Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Action/SOAP/DocumentLiteral.pm (from rev 7169, Catalyst-Controller-SOAP/1.0/trunk/lib/Catalyst/Action/SOAP/DocumentLiteral.pm)
===================================================================
--- Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Action/SOAP/DocumentLiteral.pm	                        (rev 0)
+++ Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Action/SOAP/DocumentLiteral.pm	2007-11-27 10:56:42 UTC (rev 7170)
@@ -0,0 +1,56 @@
+{ package Catalyst::Action::SOAP::DocumentLiteral;
+
+  use base qw/Catalyst::Action::SOAP/;
+
+  sub execute {
+      my $self = shift;
+      my ( $controller, $c ) = @_;
+      $self->prepare_soap_helper($c);
+      $self->prepare_soap_xml_post($c);
+      unless ($c->stash->{soap}->fault) {
+          my $envelope = $c->stash->{soap}->parsed_envelope;
+          my ($body) = $envelope->getElementsByTagName('Body',0);
+          $self->NEXT::execute($controller, $c, $body);
+      }
+  }
+};
+
+1;
+
+__END__
+
+=head1 NAME
+
+Catalyst::Action::SOAP::DocumentLiteral - Document Literal service
+
+=head1 SYNOPSIS
+
+  # not used directly.
+
+=head1 DESCRIPTION
+
+This action implements a simple parse of the envelope and passing the
+body to the service as a xml object.
+
+=head1 TODO
+
+Almost all the SOAP protocol is unsupported, only the method
+dispatching and, optionally, the soap-decoding of the arguments are
+made.
+
+=head1 AUTHORS
+
+Daniel Ruoso <daniel.ruoso at verticalone.pt>
+
+=head1 BUG REPORTS
+
+Please submit all bugs regarding C<Catalyst::Controller::SOAP> to
+C<bug-catalyst-controller-soap at rt.cpan.org>
+
+=head1 LICENSE
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+

Copied: Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Action/SOAP/HTTPGet.pm (from rev 7168, Catalyst-Controller-SOAP/1.0/trunk/lib/Catalyst/Action/SOAP/HTTPGet.pm)
===================================================================
--- Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Action/SOAP/HTTPGet.pm	                        (rev 0)
+++ Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Action/SOAP/HTTPGet.pm	2007-11-27 10:56:42 UTC (rev 7170)
@@ -0,0 +1,51 @@
+{   package Catalyst::Action::SOAP::HTTPGet;
+
+    use base qw/Catalyst::Action::SOAP/;
+
+    sub execute {
+        my $self = shift;
+        my ( $controller, $c ) = @_;
+        $self->prepare_soap_helper($c);
+        $self->NEXT::execute(@_);
+    }
+};
+
+1;
+
+__END__
+
+=head1 NAME
+
+Catalyst::Action::SOAP::HTTPGet - HTTP Get service
+
+=head1 SYNOPSIS
+
+  # not used directly.
+
+=head1 DESCRIPTION
+
+This actually is here just to help delivering services that are
+invoked by simple http get requests, as defined in the SOAP spec. It
+won't do much, except for preparing the $c->stash->{soap} variable, so
+the returns can be implemented.
+
+=head1 TODO
+
+There is not much to be done here.
+
+=head1 AUTHORS
+
+Daniel Ruoso <daniel.ruoso at verticalone.pt>
+
+=head1 BUG REPORTS
+
+Please submit all bugs regarding C<Catalyst::Controller::SOAP> to
+C<bug-catalyst-controller-soap at rt.cpan.org>
+
+=head1 LICENSE
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+

Deleted: Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Action/SOAP/RPCEndpoint.pm
===================================================================
--- Catalyst-Controller-SOAP/1.0/trunk/lib/Catalyst/Action/SOAP/RPCEndpoint.pm	2007-11-27 10:48:51 UTC (rev 7165)
+++ Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Action/SOAP/RPCEndpoint.pm	2007-11-27 10:56:42 UTC (rev 7170)
@@ -1,80 +0,0 @@
-{ package Catalyst::Action::SOAP::RPCEndpoint;
-
-  use base qw/Catalyst::Action::SOAP/;
-
-  sub execute {
-      my $self = shift;
-      my ( $controller, $c ) = @_;
-
-      $self->prepare_soap_helper($c);
-      $self->prepare_soap_xml_post($c);
-      unless ($c->stash->{soap}->fault) {
-          my $envelope = $c->stash->{soap}->parsed_envelope;
-          my ($body) = $envelope->getElementsByTagName('body',0)
-          my @children = $body->getChildNodes();
-          if (scalar @children != 1) {
-              $c->stash->{soap}->fault
-                ({ code => { 'env:Sender' => 'env:Body' },
-                   reason => 'Bad Body', detail =>
-                   'RPC messages should contain only one element inside body'})
-            } else {
-                my $operation = $children[0]->getNodeName();
-                my $arguments = $children[0]->getChildNodes();
-                $c->stash->{soap}->arguments($arguments);
-                if ($controller->action_for($operation)->attributes->{ActionClass} !~ /RPC(Encoded|Literal)/) {
-                    $c->stash->{soap}->fault
-                      ({ code => { env:Sender => 'env:Body' },
-                         reason => 'Bad Operation', detail =>
-                         'Invalid Operation'})
-                } else {
-                    # this is our RPC action
-                    $c->forward($operation);
-                }
-            }
-      }
-  }
-};
-
-1;
-
-__END__
-
-=head1 NAME
-
-Catalyst::Controller::SOAP::Action::RPCEndpoint - RPC Dispatcher
-
-=head1 SYNOPSIS
-
-  # not used directly.
-
-=head1 DESCRIPTION
-
-This class is used by L<Catalyst::Controller::SOAP> to dispatch to the
-RPC operations inside a controller. These operations are quite
-different from the others, as they are seen by Catalyst as this single
-action. During the registering phase, the soap rpc operations are
-included in the hash that is sent to this object, so they can be
-invoked later.
-
-=head1 TODO
-
-Almost all the SOAP protocol is unsupported, only the method
-dispatching and, optionally, the soap-decoding of the arguments are
-made.
-
-=head1 AUTHORS
-
-Daniel Ruoso <daniel.ruoso at verticalone.pt>
-
-=head1 BUG REPORTS
-
-Please submit all bugs regarding C<Catalyst::Controller::SOAP> to
-C<bug-catalyst-controller-soap at rt.cpan.org>
-
-=head1 LICENSE
-
-This library is free software, you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-

Copied: Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Action/SOAP/RPCEndpoint.pm (from rev 7169, Catalyst-Controller-SOAP/1.0/trunk/lib/Catalyst/Action/SOAP/RPCEndpoint.pm)
===================================================================
--- Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Action/SOAP/RPCEndpoint.pm	                        (rev 0)
+++ Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Action/SOAP/RPCEndpoint.pm	2007-11-27 10:56:42 UTC (rev 7170)
@@ -0,0 +1,80 @@
+{ package Catalyst::Action::SOAP::RPCEndpoint;
+
+  use base qw/Catalyst::Action::SOAP/;
+
+  sub execute {
+      my $self = shift;
+      my ( $controller, $c ) = @_;
+
+      $self->prepare_soap_helper($c);
+      $self->prepare_soap_xml_post($c);
+      unless ($c->stash->{soap}->fault) {
+          my $envelope = $c->stash->{soap}->parsed_envelope;
+          my ($body) = $envelope->getElementsByTagName('Body',0);
+          my @children = $body->getChildNodes();
+          if (scalar @children != 1) {
+              $c->stash->{soap}->fault
+                ({ code => { 'env:Sender' => 'env:Body' },
+                   reason => 'Bad Body', detail =>
+                   'RPC messages should contain only one element inside body'})
+            } else {
+                my $operation = $children[0]->nodeName();
+                my $arguments = $children[0]->getChildNodes();
+                $c->stash->{soap}->arguments($arguments);
+                if (!grep { /RPC(Encoded|Literal)/ } @{$controller->action_for($operation)->attributes->{ActionClass}}) {
+                    $c->stash->{soap}->fault
+                      ({ code => { 'env:Sender' => 'env:Body' },
+                         reason => 'Bad Operation', detail =>
+                         'Invalid Operation'})
+                } else {
+                    # this is our RPC action
+                    $c->forward($operation);
+                }
+            }
+      }
+  }
+};
+
+1;
+
+__END__
+
+=head1 NAME
+
+Catalyst::Controller::SOAP::Action::RPCEndpoint - RPC Dispatcher
+
+=head1 SYNOPSIS
+
+  # not used directly.
+
+=head1 DESCRIPTION
+
+This class is used by L<Catalyst::Controller::SOAP> to dispatch to the
+RPC operations inside a controller. These operations are quite
+different from the others, as they are seen by Catalyst as this single
+action. During the registering phase, the soap rpc operations are
+included in the hash that is sent to this object, so they can be
+invoked later.
+
+=head1 TODO
+
+Almost all the SOAP protocol is unsupported, only the method
+dispatching and, optionally, the soap-decoding of the arguments are
+made.
+
+=head1 AUTHORS
+
+Daniel Ruoso <daniel.ruoso at verticalone.pt>
+
+=head1 BUG REPORTS
+
+Please submit all bugs regarding C<Catalyst::Controller::SOAP> to
+C<bug-catalyst-controller-soap at rt.cpan.org>
+
+=head1 LICENSE
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+

Deleted: Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Action/SOAP.pm
===================================================================
--- Catalyst-Controller-SOAP/1.0/trunk/lib/Catalyst/Action/SOAP.pm	2007-11-27 10:48:51 UTC (rev 7165)
+++ Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Action/SOAP.pm	2007-11-27 10:56:42 UTC (rev 7170)
@@ -1,75 +0,0 @@
-{ package Catalyst::Action::SOAP;
-
-  use base qw/Catalyst::Action/;
-  use XML::DOM::XPath;
-
-  __PACKAGE__->mk_accessors(qw/xml_parser/);
-
-  sub new {
-      my $class = shift;
-      my $self = $class->SUPER::new(@_);
-      $self->xml_parser(XML::DOM::Parser->new());
-      return $self;
-  }
-
-  sub prepare_soap_helper {
-      my ($self, $c) = @_;
-      $c->stash->{soap} = Catalyst::Controller::SOAP::Helper->new();
-  }
-
-  sub prepare_soap_xml_post {
-      my ($self, $c) = @_;
-      if ($c->req->content_type =~ /application\/soap\+xml/ &&
-          $c->req->method eq 'POST') {
-          my $xml_str = $c->req->body;
-          eval {
-              $c->stash->{soap}->envelope($xml_str);
-              $c->stash->{soap}->parsed_envelope($self->xml_parser->parse($xml_str));
-          };
-          if ($@) {
-              $c->stash->{soap}->fault({ code => 'env:Sender', reason => 'Bad XML Message', detail => $@});
-          }
-      } else {
-          $c->stash->{soap}->fault({ code => 'env:Sender', reason => 'Bad content-type/method'});
-      }
-  }
-};
-
-1;
-
-__END__
-
-=head1 NAME
-
-Catalyst::Controller::SOAP::Action - Action superclass
-
-=head1 SYNOPSIS
-
-  # not used directly.
-
-=head1 DESCRIPTION
-
-This is the superclass used by the Document and the RPC actions.
-
-=head1 TODO
-
-Almost all the SOAP protocol is unsupported, only the method
-dispatching and, optionally, the soap-decoding of the arguments are
-made.
-
-=head1 AUTHORS
-
-Daniel Ruoso <daniel.ruoso at verticalone.pt>
-
-=head1 BUG REPORTS
-
-Please submit all bugs regarding C<Catalyst::Controller::SOAP> to
-C<bug-catalyst-controller-soap at rt.cpan.org>
-
-=head1 LICENSE
-
-This library is free software, you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-

Copied: Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Action/SOAP.pm (from rev 7169, Catalyst-Controller-SOAP/1.0/trunk/lib/Catalyst/Action/SOAP.pm)
===================================================================
--- Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Action/SOAP.pm	                        (rev 0)
+++ Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Action/SOAP.pm	2007-11-27 10:56:42 UTC (rev 7170)
@@ -0,0 +1,76 @@
+{ package Catalyst::Action::SOAP;
+
+  use base qw/Catalyst::Action/;
+  use XML::LibXML;
+
+  __PACKAGE__->mk_accessors(qw/xml_parser/);
+
+  sub new {
+      my $class = shift;
+      my $self = $class->SUPER::new(@_);
+      $self->xml_parser(XML::LibXML->new());
+      return $self;
+  }
+
+  sub prepare_soap_helper {
+      my ($self, $c) = @_;
+      $c->stash->{soap} = Catalyst::Controller::SOAP::Helper->new();
+  }
+
+  sub prepare_soap_xml_post {
+      my ($self, $c) = @_;
+      if ($c->req->content_type =~ /application\/soap\+xml/ &&
+          $c->req->method eq 'POST') {
+          my $body = $c->req->body;
+          my $xml_str = join '', <$body>;
+          eval {
+              $c->stash->{soap}->envelope($xml_str);
+              $c->stash->{soap}->parsed_envelope($self->xml_parser->parse_string($xml_str));
+          };
+          if ($@) {
+              $c->stash->{soap}->fault({ code => 'env:Sender', reason => 'Bad XML Message', detail => $@});
+          }
+      } else {
+          $c->stash->{soap}->fault({ code => 'env:Sender', reason => 'Bad content-type/method'});
+      }
+  }
+};
+
+1;
+
+__END__
+
+=head1 NAME
+
+Catalyst::Controller::SOAP::Action - Action superclass
+
+=head1 SYNOPSIS
+
+  # not used directly.
+
+=head1 DESCRIPTION
+
+This is the superclass used by the Document and the RPC actions.
+
+=head1 TODO
+
+Almost all the SOAP protocol is unsupported, only the method
+dispatching and, optionally, the soap-decoding of the arguments are
+made.
+
+=head1 AUTHORS
+
+Daniel Ruoso <daniel.ruoso at verticalone.pt>
+
+=head1 BUG REPORTS
+
+Please submit all bugs regarding C<Catalyst::Controller::SOAP> to
+C<bug-catalyst-controller-soap at rt.cpan.org>
+
+=head1 LICENSE
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+

Deleted: Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Controller/SOAP/RPC.pm
===================================================================
--- Catalyst-Controller-SOAP/1.0/trunk/lib/Catalyst/Controller/SOAP/RPC.pm	2007-11-27 10:48:51 UTC (rev 7165)
+++ Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Controller/SOAP/RPC.pm	2007-11-27 10:56:42 UTC (rev 7170)
@@ -1,46 +0,0 @@
-{ package Catalyst::Controller::SOAP::RPC;
-  use strict;
-  use base qw(Catalyst::Controller::SOAP);
-  sub rpc_endpoint :Path('') :SOAPRPCEndpoint { };
-};
-
-1;
-
-__END__
-
-=head1 NAME
-
-Catalyst::Controller::SOAP::RPC - Helper controller for SOAP
-
-=head1 SYNOPSIS
-
- use base qw(Catalyst::Controller::SOAP::RPC);
-
-=head1 DESCRIPTION
-
-This is a direct subclass of Catalyst::Controller::SOAP that
-predefines a rpc_endpoint method which is dispatched in the URI of the
-controller as the RPC endpoint. It's simply inteded to save you the
-job of defining that in each SOAP RPC controller you implement,
-considering that is the standard behaviour.
-
-=head1 TODO
-
-Well, here? nothing, all the work is done in the superclass.
-
-=head1 AUTHOR
-
-Daniel Ruoso <daniel.ruoso at verticalone.pt>
-
-=head1 BUG REPORTS
-
-Please submit all bugs regarding C<Catalyst::Controller::SOAP> to
-C<bug-catalyst-controller-soap at rt.cpan.org>
-
-=head1 LICENSE
-
-This library is free software, you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-

Copied: Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Controller/SOAP/RPC.pm (from rev 7169, Catalyst-Controller-SOAP/1.0/trunk/lib/Catalyst/Controller/SOAP/RPC.pm)
===================================================================
--- Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Controller/SOAP/RPC.pm	                        (rev 0)
+++ Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Controller/SOAP/RPC.pm	2007-11-27 10:56:42 UTC (rev 7170)
@@ -0,0 +1,46 @@
+{ package Catalyst::Controller::SOAP::RPC;
+  use strict;
+  use base qw(Catalyst::Controller::SOAP);
+  sub rpc_endpoint :Path('') :SOAP('RPCEndpoint') { };
+};
+
+1;
+
+__END__
+
+=head1 NAME
+
+Catalyst::Controller::SOAP::RPC - Helper controller for SOAP
+
+=head1 SYNOPSIS
+
+ use base qw(Catalyst::Controller::SOAP::RPC);
+
+=head1 DESCRIPTION
+
+This is a direct subclass of Catalyst::Controller::SOAP that
+predefines a rpc_endpoint method which is dispatched in the URI of the
+controller as the RPC endpoint. It's simply inteded to save you the
+job of defining that in each SOAP RPC controller you implement,
+considering that is the standard behaviour.
+
+=head1 TODO
+
+Well, here? nothing, all the work is done in the superclass.
+
+=head1 AUTHOR
+
+Daniel Ruoso <daniel.ruoso at verticalone.pt>
+
+=head1 BUG REPORTS
+
+Please submit all bugs regarding C<Catalyst::Controller::SOAP> to
+C<bug-catalyst-controller-soap at rt.cpan.org>
+
+=head1 LICENSE
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+

Deleted: Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Controller/SOAP.pm
===================================================================
--- Catalyst-Controller-SOAP/1.0/trunk/lib/Catalyst/Controller/SOAP.pm	2007-11-27 10:48:51 UTC (rev 7165)
+++ Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Controller/SOAP.pm	2007-11-27 10:56:42 UTC (rev 7170)
@@ -1,168 +0,0 @@
-{ package Catalyst::Controller::SOAP;
-
-    use strict;
-    use base qw/Catalyst::Controller/;
-
-    our $VERSION = '0.0.1';
-
-    sub _parse_SOAP_Attr {
-        my ($self, $c, $name, $value) = @_;
-        my $actionclass = $value =~ /^+/ ? $value :
-          'SOAP::'.$value;
-        (
-         ActionClass => $actionclass,
-        )
-    }
-
-};
-
-{ package Catalyst::Controller::SOAP::Helper;
-
-  use base qw(Class::Accessor::Fast);
-
-  __PACKAGE__->mk_accessors(qw{envelope parsed_envelope arguments error
-                               encoded_return literal_return
-                               literal_string_return string_return});
-
-};
-
-1;
-
-__END__
-
-=head1 NAME
-
-Catalyst::Controller::SOAP -- Catalyst SOAP Controller
-
-=head1 SYNOPSIS
-
-    package MyApp::Controller::Example;
-    use base 'Catalyst::Controller::SOAP';
-
-    # available in "/example" as operation "echo"
-    # parsing the arguments as soap-encoded.
-    sub echo : SOAP('RPCEncoded') {
-        my ( $self, $c, @args ) = @_;
-    }
-
-    # available in "/example" as operation "ping". The arguments are
-    # treated as a literal document and passed to the method as a
-    # XML::DOM::XPath object
-    sub ping : SOAP('RPCLiteral') {
-        my ( $self, $c, $xml) = @_;
-        my $name = $xml->findValue('some xpath expression');
-    }
-
-    # avaiable as "/example/world" in document context. The entire body
-    # is delivered to the method as a XML::DOM::XPath object.
-    sub world : SOAP('DocLiteral') {
-        my ($self, $c, $doc) = @_;
-    }
-
-    # this is the endpoint from where the RPC operations will be
-    # dispatched. This code won't be executed at all.
-    sub index : SOAP('RPCEndpoint') {}
-
-=head1 DESCRIPTION
-
-SOAP Controller for Catalyst which we tried to make compatible with
-the way Catalyst works with URLS.
-
-It is important to notice that this controller declares by default an
-index operation which will dispatch the RPC operations under this
-class.
-
-=back
-
-=head1 ATTRIBUTES
-
-This class implements the SOAP attribute wich is used to do the
-mapping of that operation to the apropriate action class. The name of
-the class used is formed as Catalyst::Action::SOAP::$value, unless the
-parameter of the attribute starts with a '+', which implies complete
-namespace.
-
-The implementation of SOAP Action classes helps delivering specific
-SOAP scenarios, like HTTP GET, RPC Encoded, RPC Literal or Document
-Literal, or even Document RDF or just about any required combination.
-
-See L<Catalyst::Action::SOAP::DocLiteral> for an example.
-
-=head1 ACCESSORS
-
-Once you tagged one of the methods, you'll have an $c->stash->{soap}
-accessor which will return an C<Catalyst::Controller::SOAP::Helper>
-object. It's important to notice that this is achieved by the fact
-that all the SOAP Action classes are subclasses of
-Catalyst::Action::SOAP, which implements most of that.
-
-You can query this object as follows:
-
-=over 4
-
-=item $c->stash->{soap}->envelope()
-
-The original SOAP envelope as string.
-
-=item $c->stash->{soap}->parsed_envelope()
-
-The parsed envelope as an XML::DOM::XPath object.
-
-=item $c->stash->{soap}->arguments()
-
-The arguments of a RPC call.
-
-=item $c->stash->{soap}->error($c,[$code,$message])
-
-Allows you to set fault code and message
-
-=item $c->stash->{soap}->encoded_return(\@data)
-
-This method will prepare the return value to be a soap encoded data.
-
-=item $c->stash->{soap}->literal_return($xml_node)
-
-This method will prepare the return value to be a literal XML
-document, in this case, you can pass just the node that will be the
-root in the return message.
-
-=item $c->stash->{soap}->literal_string_return($xml_text)
-
-In this case, the argument is used literally inside the message. It is
-supposed to already contain all namespace definitions in it.
-
-=item $c->stash->{soap}->string_return($non_xml_text)
-
-In this case, the given text is encoded as CDATA inside the SOAP
-message.
-
-=back
-
-=head1 TODO
-
-At this moment, this is a very early release. So almost everything is
-still to be done. The only thing done right now is getting the body
-from the message and dispatching the correct method.
-
-=head1 SEE ALSO
-
-L<Catalyst::Action::SOAP>, L<XML::DOM::XPath>,
-L<Catalyst::Action::SOAP::DocLiteral>,
-L<Catalyst::Action::SOAP::RPCEncoded>,
-L<Catalyst::Action::SOAP::HTTPGet>
-
-=head1 AUTHORS
-
-Daniel Ruoso C<daniel.ruoso at verticalone.pt>
-
-=head1 BUG REPORTS
-
-Please submit all bugs regarding C<Catalyst::Controller::SOAP> to
-C<bug-catalyst-controller-soap at rt.cpan.org>
-
-=head1 LICENSE
-
-This library is free software, you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut

Copied: Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Controller/SOAP.pm (from rev 7169, Catalyst-Controller-SOAP/1.0/trunk/lib/Catalyst/Controller/SOAP.pm)
===================================================================
--- Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Controller/SOAP.pm	                        (rev 0)
+++ Catalyst-Controller-SOAP/1.0/tags/0.0.3/lib/Catalyst/Controller/SOAP.pm	2007-11-27 10:56:42 UTC (rev 7170)
@@ -0,0 +1,260 @@
+{   package Catalyst::Controller::SOAP;
+
+    use strict;
+    use base qw/Catalyst::Controller/;
+    use XML::LibXML;
+
+    use constant NS_SOAP_ENV => "http://www.w3.org/2003/05/soap-envelope";
+    our $VERSION = '0.0.3';
+
+    sub _parse_SOAP_attr {
+        my ($self, $c, $name, $value) = @_;
+        my $actionclass = ($value =~ /^\+/ ? $value :
+          'Catalyst::Action::SOAP::'.$value);
+        (
+         ActionClass => $actionclass,
+        )
+    }
+
+    # this is implemented as to respond a SOAP message according to
+    # what has been sent to $c->stash->{soap}
+    sub end : Private {
+        my ($self, $c) = (shift, shift);
+        my $soap = $c->stash->{soap};
+
+        return $self->NEXT::end($c, @_) unless $soap;
+
+        my $response = XML::LibXML->createDocument();
+
+        my $envelope = $response->createElementNS
+          (NS_SOAP_ENV,"Envelope");
+
+        $response->setDocumentElement($envelope);
+
+        # TODO: we don't support header generation in response yet.
+
+        my $body = $response->createElementNS
+          (NS_SOAP_ENV,"Body");
+
+        $envelope->appendChild($body);
+
+        if ($soap->fault) {
+            my $fault = $response->createElementNS
+              (NS_SOAP_ENV, "Fault");
+            $body->appendChild($fault);
+
+            my $code = $response->createElementNS
+              (NS_SOAP_ENV, "Code");
+            $fault->appendChild($code);
+
+            $self->_generate_Fault_Code($response,$code,$soap->fault->{code});
+
+            if ($soap->fault->{reason}) {
+                my $reason = $response->createElementNS
+                  (NS_SOAP_ENV, "Reason");
+                $fault->appendChild($reason);
+                # TODO: we don't support the xml:lang attribute yet.
+                my $text = $response->createElementNS
+                  (NS_SOAP_ENV, "Text");
+                $reason->appendChild($text);
+                $text->appendText($soap->fault->{reason});
+            }
+            if ($soap->fault->{detail}) {
+                my $detail = $response->createElementNS
+                  (NS_SOAP_ENV, "Detail");
+                $fault->appendChild($detail);
+                # TODO: we don't support the xml:lang attribute yet.
+                my $text = $response->createElementNS
+                  (NS_SOAP_ENV, "Text");
+                $detail->appendChild($text);
+                $text->appendText($soap->fault->{detail});
+            }
+        } else {
+            # TODO: Generate the body.
+            # At this moment, for the sake of getting something ready,
+            # let's implement the string return.
+            if ($soap->string_return) {
+                $body->appendText($soap->string_return);
+            }
+        }
+
+        $c->res->body($envelope->toString());
+    }
+
+    sub _generate_Fault_Code {
+        my ($self, $document, $codenode, $codeValue) = @_;
+
+        my $value = $document->createElementNS
+          (NS_SOAP_ENV, "Value");
+        if (ref $codeValue eq 'ARRAY') {
+            $value->appendText($codeValue->[0]);
+            my $subcode = $document->createElementNS
+              (NS_SOAP_ENV, 'SubCode');
+            $codenode->appendChild($value);
+            $codenode->appendChild($subcode);
+            $self->_generate_Fault_Code($document, $subcode, $codeValue->[1]);
+        } else {
+            $value->appendText($codeValue);
+            $codenode->appendChild($value);
+        }
+    }
+
+
+};
+
+{   package Catalyst::Controller::SOAP::Helper;
+
+    use base qw(Class::Accessor::Fast);
+
+    __PACKAGE__->mk_accessors(qw{envelope parsed_envelope arguments fault
+                               encoded_return literal_return
+                               literal_string_return string_return});
+
+
+};
+
+1;
+
+__END__
+
+=head1 NAME
+
+Catalyst::Controller::SOAP - Catalyst SOAP Controller
+
+=head1 SYNOPSIS
+
+    package MyApp::Controller::Example;
+    use base 'Catalyst::Controller::SOAP';
+
+    # available in "/example" as operation "echo"
+    # parsing the arguments as soap-encoded.
+    sub echo : SOAP('RPCEncoded') {
+        my ( $self, $c, @args ) = @_;
+    }
+
+    # available in "/example" as operation "ping". The arguments are
+    # treated as a literal document and passed to the method as a
+    # XML::LibXML object
+    sub ping : SOAP('RPCLiteral') {
+        my ( $self, $c, $xml) = @_;
+        my $name = $xml->findValue('some xpath expression');
+    }
+
+    # avaiable as "/example/world" in document context. The entire body
+    # is delivered to the method as a XML::LibXML object.
+    sub world : SOAP('DocLiteral') {
+        my ($self, $c, $doc) = @_;
+    }
+
+    # this is the endpoint from where the RPC operations will be
+    # dispatched. This code won't be executed at all.
+    sub index : SOAP('RPCEndpoint') {}
+
+=head1 ABSTACT
+
+Implements SOAP serving support in Catalyst.
+
+=head1 DESCRIPTION
+
+SOAP Controller for Catalyst which we tried to make compatible with
+the way Catalyst works with URLS.It is important to notice that this
+controller declares by default an index operation which will dispatch
+the RPC operations under this class.
+
+=back
+
+=head1 ATTRIBUTES
+
+This class implements the SOAP attribute wich is used to do the
+mapping of that operation to the apropriate action class. The name of
+the class used is formed as Catalyst::Action::SOAP::$value, unless the
+parameter of the attribute starts with a '+', which implies complete
+namespace.
+
+The implementation of SOAP Action classes helps delivering specific
+SOAP scenarios, like HTTP GET, RPC Encoded, RPC Literal or Document
+Literal, or even Document RDF or just about any required combination.
+
+See L<Catalyst::Action::SOAP::DocLiteral> for an example.
+
+=head1 ACCESSORS
+
+Once you tagged one of the methods, you'll have an $c->stash->{soap}
+accessor which will return an C<Catalyst::Controller::SOAP::Helper>
+object. It's important to notice that this is achieved by the fact
+that all the SOAP Action classes are subclasses of
+Catalyst::Action::SOAP, which implements most of that.
+
+You can query this object as follows:
+
+=over 4
+
+=item $c->stash->{soap}->envelope()
+
+The original SOAP envelope as string.
+
+=item $c->stash->{soap}->parsed_envelope()
+
+The parsed envelope as an XML::LibXML object.
+
+=item $c->stash->{soap}->arguments()
+
+The arguments of a RPC call.
+
+=item $c->stash->{soap}->fault({code => $code,reason => $reason, detail => $detail])
+
+Allows you to set fault code and message. Optionally, you may define
+the code itself as an arrayref where the first item will be this code
+and the second will be the subcode, which recursively may be another
+arrayref.
+
+=item $c->stash->{soap}->encoded_return(\@data)
+
+This method will prepare the return value to be a soap encoded data.
+
+=item $c->stash->{soap}->literal_return($xml_node)
+
+This method will prepare the return value to be a literal XML
+document, in this case, you can pass just the node that will be the
+root in the return message.
+
+=item $c->stash->{soap}->literal_string_return($xml_text)
+
+In this case, the argument is used literally inside the message. It is
+supposed to already contain all namespace definitions in it.
+
+=item $c->stash->{soap}->string_return($non_xml_text)
+
+In this case, the given text is encoded as CDATA inside the SOAP
+message.
+
+=back
+
+=head1 TODO
+
+At this moment, this is a very early release. So almost everything is
+still to be done. The only thing done right now is getting the body
+from the message and dispatching the correct method.
+
+=head1 SEE ALSO
+
+L<Catalyst::Action::SOAP>, L<XML::LibXML>,
+L<Catalyst::Action::SOAP::DocLiteral>,
+L<Catalyst::Action::SOAP::RPCEncoded>,
+L<Catalyst::Action::SOAP::HTTPGet>
+
+=head1 AUTHORS
+
+Daniel Ruoso C<daniel.ruoso at verticalone.pt>
+
+=head1 BUG REPORTS
+
+Please submit all bugs regarding C<Catalyst::Controller::SOAP> to
+C<bug-catalyst-controller-soap at rt.cpan.org>
+
+=head1 LICENSE
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut

Copied: Catalyst-Controller-SOAP/1.0/tags/0.0.3/t (from rev 7165, Catalyst-Controller-SOAP/1.0/trunk/t)

Deleted: Catalyst-Controller-SOAP/1.0/tags/0.0.3/t/Catalyst-Controller-SOAP.t
===================================================================
--- Catalyst-Controller-SOAP/1.0/trunk/t/Catalyst-Controller-SOAP.t	2007-11-27 10:48:51 UTC (rev 7165)
+++ Catalyst-Controller-SOAP/1.0/tags/0.0.3/t/Catalyst-Controller-SOAP.t	2007-11-27 10:56:42 UTC (rev 7170)
@@ -1,15 +0,0 @@
-# Before `make install' is performed this script should be runnable with
-# `make test'. After `make install' it should work as `perl Catalyst-Controller-SOAP.t'
-
-#########################
-
-# change 'tests => 1' to 'tests => last_test_to_print';
-
-use Test::More tests => 1;
-BEGIN { use_ok('Catalyst::Controller::SOAP') };
-
-#########################
-
-# Insert your test code below, the Test::More module is use()ed here so read
-# its man page ( perldoc Test::More ) for help writing this test script.
-

Copied: Catalyst-Controller-SOAP/1.0/tags/0.0.3/t/Catalyst-Controller-SOAP.t (from rev 7169, Catalyst-Controller-SOAP/1.0/trunk/t/Catalyst-Controller-SOAP.t)
===================================================================
--- Catalyst-Controller-SOAP/1.0/tags/0.0.3/t/Catalyst-Controller-SOAP.t	                        (rev 0)
+++ Catalyst-Controller-SOAP/1.0/tags/0.0.3/t/Catalyst-Controller-SOAP.t	2007-11-27 10:56:42 UTC (rev 7170)
@@ -0,0 +1,33 @@
+use Test::More tests => 2;
+BEGIN { use_ok('Catalyst::Controller::SOAP') };
+use Catalyst::Action::SOAP::DocumentLiteral;
+use lib qw(lib t/lib);
+use Catalyst::Test 'TestApp';
+use Encode;
+
+#my $message = <<SOAP;
+#<Envelope xmlns="http://www.w3.org/2003/05/soap-envelope">
+#    <Body>World</Body>
+#</Envelope>
+#SOAP
+
+#my $response = post_soap('/ws/hello',$message);
+#my $response_content = $response->content;
+#ok($response_content =~ /Hello World/, 'Document Literal POST!');
+
+my $response_content = get('/ws/foo?who=World');
+ok($response_content =~ /Hello World/, 'Hello World!');
+
+sub post_soap {
+    my $uri = shift;
+    my $xml_content = shift;
+    require HTTP::Request::AsCGI;
+    my $request = Catalyst::Utils::request( $uri );
+    $request->method('POST');
+    $request->content_type('application/soap+xml');
+    $request->content_encoding('utf8');
+    $request->content(encode_utf8($xml_content));
+    my $cgi = HTTP::Request::AsCGI->new( $request, %ENV )->setup;
+    TestApp->handle_request;
+    return $cgi->restore->response;
+}

Copied: Catalyst-Controller-SOAP/1.0/tags/0.0.3/t/PostApp (from rev 7169, Catalyst-Controller-SOAP/1.0/trunk/t/PostApp)

Copied: Catalyst-Controller-SOAP/1.0/tags/0.0.3/t/lib (from rev 7168, Catalyst-Controller-SOAP/1.0/trunk/t/lib)




More information about the Catalyst-commits mailing list