=encoding utf8
=head1 NAME
XML::Compile::SOAP::Daemon::PSGI - PSGI based application
=head1 INHERITANCE
XML::Compile::SOAP::Daemon::PSGI
is a XML::Compile::SOAP::Daemon
XML::Compile::SOAP::Daemon::PSGI
is a Plack::Component
=head1 SYNOPSIS
#### have a look in the examples directory!
use XML::Compile::SOAP::Daemon::PSGI;
my $daemon = XML::Compile::SOAP::Daemon::PSGI->new;
# initialize definitions from WSDL
my $wsdl = XML::Compile::WSDL11->new(...);
$wsdl->importDefinitions(...); # more schemas
$daemon->operationsFromWSDL($wsdl, callbacks => ...);
# generate PSGI application
my $app = $daemon->to_app;
$app;
=head1 DESCRIPTION
This module handles the exchange of SOAP messages via PSGI stack,
using Plack toolkit. This module was contributed by Piotr Roszatycki.
This abstraction level of the object (code in this pm file) is not
concerned with parsing or composing XML, but only worries about the
HTTP transport specifics of SOAP messages.
Extends L<"DESCRIPTION" in XML::Compile::SOAP::Daemon|XML::Compile::SOAP::Daemon/"DESCRIPTION">.
=head1 METHODS
Extends L<"METHODS" in XML::Compile::SOAP::Daemon|XML::Compile::SOAP::Daemon/"METHODS">.
=head2 Constructors
Extends L<"Constructors" in XML::Compile::SOAP::Daemon|XML::Compile::SOAP::Daemon/"Constructors">.
=over 4
=item XML::Compile::SOAP::Daemon::PSGI-E<gt>B<new>(%options)
-Option --Defined in --Default
accept_slow_select XML::Compile::SOAP::Daemon <true>
output_charset XML::Compile::SOAP::Daemon 'UTF-8'
postprocess undef
preprocess undef
soap_action_input XML::Compile::SOAP::Daemon {}
wsa_action_input XML::Compile::SOAP::Daemon {}
wsa_action_output XML::Compile::SOAP::Daemon {}
=over 2
=item accept_slow_select => BOOLEAN
=item output_charset => STRING
=item postprocess => CODE
When defined, the CODE will get called with a Plack::Request and
Plack::Response objects after processing SOAP message.
=item preprocess => CODE
When defined, the CODE will get called with a Plack::Request object
before processing SOAP message.
=item soap_action_input => HASH|ARRAY
=item wsa_action_input => HASH|ARRAY
=item wsa_action_output => HASH|ARRAY
=back
=back
=head2 Attributes
Extends L<"Attributes" in XML::Compile::SOAP::Daemon|XML::Compile::SOAP::Daemon/"Attributes">.
=over 4
=item $obj-E<gt>B<addSoapAction>(HASH|PAIRS)
Inherited, see L<XML::Compile::SOAP::Daemon/"Attributes">
=item $obj-E<gt>B<addWsaTable>( <'INPUT'|'OUTPUT'>, [HASH|PAIRS] )
Inherited, see L<XML::Compile::SOAP::Daemon/"Attributes">
=item $obj-E<gt>B<outputCharset>()
Inherited, see L<XML::Compile::SOAP::Daemon/"Attributes">
=back
=head2 Running the server
Extends L<"Running the server" in XML::Compile::SOAP::Daemon|XML::Compile::SOAP::Daemon/"Running the server">.
=over 4
=item $obj-E<gt>B<call>($env)
Process the content of a single message. Not to be called directly.
=item $obj-E<gt>B<process>($client, $xmlin, $request, $action)
Inherited, see L<XML::Compile::SOAP::Daemon/"Running the server">
=item $obj-E<gt>B<run>(%options)
The same as B<to_app> but accepts additional B<preprocess> and
B<postprocess> options.
=item $obj-E<gt>B<to_app>()
Converts the server into a PSGI C<$app>.
=back
=head2 Preparations
Extends L<"Preparations" in XML::Compile::SOAP::Daemon|XML::Compile::SOAP::Daemon/"Preparations">.
=over 4
=item $obj-E<gt>B<addHandler>($name, $soap, CODE)
Inherited, see L<XML::Compile::SOAP::Daemon/"Preparations">
=item $obj-E<gt>B<operationsFromWSDL>($wsdl, %options)
Inherited, see L<XML::Compile::SOAP::Daemon/"Preparations">
=item $obj-E<gt>B<setWsdlResponse>( $filename, [$filetype] )
Inherited, see L<XML::Compile::SOAP::Daemon/"Preparations">
=back
=head2 Helpers
Extends L<"Helpers" in XML::Compile::SOAP::Daemon|XML::Compile::SOAP::Daemon/"Helpers">.
=over 4
=item $obj-E<gt>B<faultInvalidXML>($error)
Inherited, see L<XML::Compile::SOAP::Daemon/"Helpers">
=item $obj-E<gt>B<faultNotSoapMessage>($nodetype)
Inherited, see L<XML::Compile::SOAP::Daemon/"Helpers">
=item $obj-E<gt>B<faultUnsupportedSoapVersion>($env_ns)
Inherited, see L<XML::Compile::SOAP::Daemon/"Helpers">
=item $obj-E<gt>B<handlers>( <'SOAP11'|'SOAP12'|$soap> )
Inherited, see L<XML::Compile::SOAP::Daemon/"Helpers">
=item $obj-E<gt>B<printIndex>( [$fh] )
Inherited, see L<XML::Compile::SOAP::Daemon/"Helpers">
=item $obj-E<gt>B<soapVersions>()
Inherited, see L<XML::Compile::SOAP::Daemon/"Helpers">
=back
=head1 DETAILS
Extends L<"DETAILS" in XML::Compile::SOAP::Daemon|XML::Compile::SOAP::Daemon/"DETAILS">.
=head2 Operation handlers
Extends L<"Operation handlers" in XML::Compile::SOAP::Daemon|XML::Compile::SOAP::Daemon/"Operation handlers">.
=head2 Returning errors
Extends L<"Returning errors" in XML::Compile::SOAP::Daemon|XML::Compile::SOAP::Daemon/"Returning errors">.
=head2 How to use the PSGI module
The code and documentation for this module was contributed by Piotr
Roszatycki in March 2012.
Go to the F<examples/mod_perl/> directory which is included in the
distribution of this module, L<XML::Compile::SOAP::Daemon|XML::Compile::SOAP::Daemon> There you
find a README describing the process.
=head2 Using Basic Authenication
[example contributed by Emeline Thibault]
my $daemon = XML::Compile::SOAP::Daemon::PSGI->new(...);
$daemon->operationsFromWSDL($wsdl, callbacks => {...});
use Plack::Middleware::Auth::Basic;
my %map = ( admin => "password" );
builder {
enable "Auth::Basic", authenticator => \&cb;
$daemon;
};
sub cb {
my ( $username, $password ) = @_;
return $map{$username} && $password eq $map{$username};
}
=head1 SEE ALSO
This module is part of XML-Compile-SOAP-Daemon distribution version 3.12,
built on May 13, 2016. Website: F<http://perl.overmeer.net/xml-compile/>
Please post questions or ideas to the mailinglist at
F<http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/xml-compile> .
For live contact with other developers, visit the C<#xml-compile> channel
on C<irc.perl.org>.
=head1 LICENSE
Copyrights 2007-2016 by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>