SOAP-Lite

 view release on metacpan or  search on metacpan

lib/SOAP/Server.pod  view on Meta::CPAN

    $server->on_action(sub { ...new code });

Gets or sets the reference to a subroutine that is used for executing the on_action hook. Where the client code uses this hook to construct the action-request data (such as for a SOAPAction header), the server uses the on_action hook to do any last-m...

=over

=item action

The action URI itself, retrieved from the action method described earlier.

=item method_uri

The URI of the XML namespace the method name is labeled with.

=item method_name

The name of the method being called by the request.

=back

=item on_dispatch(optional new value)

    ($uri, $name) = $server->on_dispatch->($request);

Gets or sets the subroutine reference used for the on_dispatch hook. This hook is called at the start of the request-routing phase and is given a single argument when called:

=over

=item request

An object of the L<SOAP::SOM> class, containing the deserialized request from the client.

=back

=item find_target

    ($class, $uri, $name) = $server->find_target($req)

Taking as its argument an object of the SOAP::SOM class that contains the deserialized request, this method returns a three-element list describing the method that is to be called. The elements are:

=over

=item class

The class into which the method call should be made. This may come back as either a string or an objectreference, if the dispatching is configured using an object instance.

=item uri

The URN associated with the request method. This is the value that was used when configuring the method routing on the server object.

=item name

The name of the method to call.

=back

=item handle

    $server->handle($request_text);

Implements the main functionality of the serving process, in which the server takes an incoming request and dispatches it to the correct server-side subroutine. The parameter taken as input is either plain XML or MIME-encoded content (if MIME-encodin...

=item make_fault

    return $server->makefault($code, $message);

Creates a SOAP::Fault object from the data passed in. The order of arguments is: code, message, detail, actor. The first two are required (because they must be present in all faults), but the last two may be omitted unless needed.

=back

=head2 SOAP::Server::Parameters

This class provides two methods, but the primary purpose from the developer's point of view is to allow classes that a SOAP server exposes to inherit from it. When a class inherits from the SOAP::Server::Parameters class, the list of parameters passe...

The class provides two subroutines (not methods), for retrieving parameters from the L<SOAP::SOM> object. These are designed to be called without an object reference in the parameter list, but with an array reference instead (as the first parameter)....

=over

=item byNameOrOrder(order, parameter list, envelope)

    @args = SOAP::Server::Parameters::byNameOrOrder ([qw(a b)], @_);

Using the list of argument names passed in the initial argument as an array reference, this routine returns a list of the parameter values for the parameters matching those names, in that order. If none of the names given in the initial array-referen...

=item byName(order, parameter list, envelope)

    @args = SOAP::Server::Parameters::byName ([qw(a b c)], @_);

Acts in a similar manner to the previous, with the difference that it always returns as many values as requested, even if some (or all) don't exist. Parameters that don't exist in the parameter list are returned as undef values.

=back

=head3 EXAMPLE

The following is an example CGI based Web Service that utilizes a Perl module that inherits from the C<SOAP::Server::Parameters> class. This allows the methods of that class to access its input by name.

    #!/usr/bin/perl
    use SOAP::Transport::HTTP;
    SOAP::Transport::HTTP::CGI
      ->dispatch_to('C2FService')
      ->handle;
    BEGIN {
      package C2FService;
      use vars qw(@ISA);
      @ISA = qw(Exporter SOAP::Server::Parameters);
      use SOAP::Lite;
      sub c2f {
        my $self = shift;
        my $envelope = pop;
        my $temp = $envelope->dataof("//c2f/temperature");
        return SOAP::Data->name('convertedTemp' => (((9/5)*($temp->value)) + 32));
      }
    }

=head1 SEE ALSO

L<SOAP::SOM>, L<SOAP::Transport::HTTP>

=head1 ACKNOWLEDGEMENTS

Special thanks to O'Reilly publishing which has graciously allowed SOAP::Lite to republish and redistribute large excerpts from I<Programming Web Services with Perl>, mainly the SOAP::Lite reference found in Appendix B.

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 3.635 seconds using v1.00-cache-2.02-grep-82fe00e-cpan-9f2165ba459b )