Catalyst::Action::SOAP::DocumentLiteral - Document Literal service


Catalyst-Controller-SOAP documentation Contained in the Catalyst-Controller-SOAP distribution.

Index


Code Index:

NAME

Top

Catalyst::Action::SOAP::DocumentLiteral - Document Literal service

SYNOPSIS

Top

  # not used directly.

DESCRIPTION

Top

This action implements a simple parse of the envelope and passing the body to the service as a xml object.

TODO

Top

Almost all the SOAP protocol is unsupported, only the method dispatching and, optionally, the soap-decoding of the arguments are made.

AUTHORS

Top

Daniel Ruoso <daniel@ruoso.com>

BUG REPORTS

Top

Please submit all bugs regarding Catalyst::Controller::SOAP to bug-catalyst-controller-soap@rt.cpan.org

LICENSE

Top

This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.


Catalyst-Controller-SOAP documentation Contained in the Catalyst-Controller-SOAP distribution.

{ package Catalyst::Action::SOAP::DocumentLiteral;

  use base qw/Catalyst::Action::SOAP/;
  use constant NS_SOAP_ENV => "http://schemas.xmlsoap.org/soap/envelope/";

  sub execute {
      my $self = shift;
      my ( $controller, $c ) = @_;
      $self->prepare_soap_helper($controller,$c);
      $self->prepare_soap_xml_post($controller,$c);
      unless ($c->stash->{soap}->fault) {
          my $envelope = $c->stash->{soap}->parsed_envelope;
          my $namespace = $c->stash->{soap}->namespace || NS_SOAP_ENV;
          my ($body) = $envelope->getElementsByTagNameNS($namespace, 'Body');
          my $operation = $self->name;
          $c->stash->{soap}->operation_name($operation);
          eval {
              if ($controller->wsdlobj) {
                  $body = $c->stash->{soap}->arguments
                    ($controller->decoders->{$operation}->($body));
              }
          };
          if ($@) {
              $c->stash->{soap}->fault
                ({ code => 'SOAP-ENV:Client',
                   reason => 'Bad Body', detail =>
                   'Schema validation on the body failed: '.$@});
          } else {
              $self->next::method($controller, $c, $body);
          }
      }
  }
};

1;

__END__