The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
=encoding utf8

=head1 NAME

XML::Compile::SOAP::Daemon::LWPutil - LWP helper routines

=head1 INHERITANCE

 XML::Compile::SOAP::Daemon::LWPutil
   is a Exporter

=head1 SYNOPSIS

  # used by ::Daemon::NetServer
  #     and ::Daemon::AnyDaemon

=head1 DESCRIPTION

=head1 FUNCTIONS

=over 4

=item B<lwp_action_from_header>($request)

Collect the soap action URI from the request, with C<undef> on failure.
Officially, the "SOAPAction" has no other purpose than the ability to
route messages over HTTP: it should not be linked to the portname of
the message (although it often can).

=item B<lwp_add_header>($field, $content, ...)

=item B<lwp_handle_connection>($connection, %options)

=item B<lwp_http11_connection>($daemon, $socket)

Initialize a HTTP/1.1 connect on the client $socket.

=item B<lwp_make_response>( $request, $rc, $msg, $body, [$postproc] )

=item B<lwp_run_request>( $request, $handler, [$connection, $postproc] )

Handle one $request (HTTP::Request object), which was received from
the CLIENT (string).  When the request has been received, the $handler
is called. Returns the status, the status as text message, and the
output as XML::LibXML::Document.

=item B<lwp_socket_init>($socket)

Initialize LWP usage based on a created $socket.

=item B<lwp_wsdl_response>( [$wsdlfile|$response] )

Set the result of WSDL query responses, either to a response which
is created internally containing $wsdlfile, or to an already complete
$response object (HTTP::Response).  The response object is returned.

=back

=head1 DETAILS

=head2 Postprocessing responses

The C<LWP> based daemons provide a C<postprocess> option to their C<run()>
methods.  The parameter is a CODE reference.

When defined, the CODE is called when the response message is ready
to be returned to the client:

  $code->($request, $response, $status, \$body)

The source C<$requests> is passed as first parameter.  The C<$response>
is an HTTP::Response object, with all headers but without the body.
The C<$status> is the result code of the handler.  A value of 200
(C<HTTP_OK> from C<HTTP::Status>) indicates successful processing of the
request.  When the status is not HTTP_OK you may skip the postprocessing.

The C<$body> are the bytes which will be added as body to the response
after this postprocessing has been done.  You may change the body.
B<Be warned> that the body is not a (latin1 or utf-8) string but already
encoded into a byte string.

=head1 SEE ALSO

This module is part of XML-Compile-SOAP-Daemon distribution version 3.14,
built on May 11, 2018. Website: F<http://perl.overmeer.net/CPAN/>

=head1 LICENSE

Copyrights 2007-2018 by [Mark Overmeer <markov@cpan.org>]. 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://dev.perl.org/licenses/>