NAME

XML::Compile::SOAP::Daemon::NetServer - SOAP server based on Net::Server

INHERITANCE

XML::Compile::SOAP::Daemon::NetServer
  is a XML::Compile::SOAP::Daemon

SYNOPSIS

#### have a look in the examples directory!
use XML::Compile::SOAP::Daemon::NetServer;
use XML::Compile::SOAP11;
use XML::Compile::SOAP::WSA;  # optional

# Be warned that the daemon will be Net::Server based, which
# consumes command-line arguments! "local @ARGV;" maybe useful
my $daemon  = XML::Compile::SOAP::Daemon::NetServer->new;

# daemon definitions from WSDL
my $wsdl    = XML::Compile::WSDL11->new(...);
$wsdl->importDefinitions(...); # more schemas
$daemon->operationsFromWSDL($wsdl, callbacks => ...);

# daemon definitions added manually (when no WSDL)
my $soap11  = XML::Compile::SOAP11::Server->new(schemas => $wsdl->schemas);
my $handler = $soap11->compileHandler(...);
$daemon->addHandler('getInfo', $soap11, $handler);

# see what is defined:
$daemon->printIndex;

# finally, run the server.  This never returns.
$daemon->run(@daemon_options);

DESCRIPTION

This module handles the exchange of SOAP messages over HTTP with Net::Server as daemon implementation, It uses HTTP::Request and HTTP::Response object provided by LWP, via functions provided by XML::Compile::SOAP::Daemon::LWPutil.

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. The processing of the SOAP message is handled by the XML::Compile::SOAP::Daemon base-class.

The server is as flexible as possible: accept M-POST (HTTP Extension Framework) and POST (standard HTTP) for any message. It can be used for any SOAP1.1 and SOAP1.2 mixture. Although SOAP1.2 itself is not implemented yet.

METHODS

Constructors

XML::Compile::SOAP::Daemon::NetServer->new(OPTIONS)

Create the server handler, which extends some class which implements a Net::Server daemon. Any daemon configuration parameter should be passed with run(). This is a little tricky. Read below in the "Configuration options" section.

-Option            --Defined in     --Default
 accept_slow_select  XML::Compile::SOAP::Daemon  <true>
 based_on                             Net::Server::PreFork
 output_charset      XML::Compile::SOAP::Daemon  'UTF-8'
 soap_action_input   XML::Compile::SOAP::Daemon  {}
 wsa_action_input    XML::Compile::SOAP::Daemon  {}
 wsa_action_output   XML::Compile::SOAP::Daemon  {}
accept_slow_select => BOOLEAN
based_on => any Net::Server OBJECT|CLASS

You may pass your own Net::Server compatible daemon, if you feel a need to initialize it or prefer an other one. Preferrably, pass configuration settings to run(). You may also specify any Net::Server compatible CLASS name.

output_charset => STRING
soap_action_input => HASH|ARRAY
wsa_action_input => HASH|ARRAY
wsa_action_output => HASH|ARRAY

Attributes

$obj->addSoapAction(HASH|PAIRS)

See "Attributes" in XML::Compile::SOAP::Daemon

$obj->addWsaTable(('INPUT'|'OUTPUT'), [HASH|PAIRS])

See "Attributes" in XML::Compile::SOAP::Daemon

$obj->outputCharset()

See "Attributes" in XML::Compile::SOAP::Daemon

Running the server

$obj->process(CLIENT, XMLIN, REQUEST, ACTION)

See "Running the server" in XML::Compile::SOAP::Daemon

$obj->run(OPTIONS)

See Net::Server subroutine run, but the OPTIONS are passed as list, not as HASH. You may pass any option to which accepted by the Net::Server extension you are using.

-Option     --Default
 postprocess  undef
postprocess => CODE

See the section about this option in the DETAILS chapter of the XML::Compile::SOAP::Daemon::LWPutil manual-page.

Preparations

$obj->addHandler(NAME, SOAP, CODE)

See "Preparations" in XML::Compile::SOAP::Daemon

$obj->operationsFromWSDL(WSDL, OPTIONS)

See "Preparations" in XML::Compile::SOAP::Daemon

$obj->setWsdlResponse(FILENAME)

See "Preparations" in XML::Compile::SOAP::Daemon

Helpers

$obj->faultInvalidXML(ERROR)

See "Helpers" in XML::Compile::SOAP::Daemon

$obj->faultNotSoapMessage(NODETYPE)

See "Helpers" in XML::Compile::SOAP::Daemon

$obj->faultUnsupportedSoapVersion(ENV_NS)

See "Helpers" in XML::Compile::SOAP::Daemon

$obj->handlers(('SOAP11'|'SOAP12'|SOAP))

See "Helpers" in XML::Compile::SOAP::Daemon

$obj->printIndex([FILEHANDLE])

See "Helpers" in XML::Compile::SOAP::Daemon

$obj->soapVersions()

See "Helpers" in XML::Compile::SOAP::Daemon

DETAILS

Operation handlers

Returning errors

Returning general errors

Returning private errors

Configuration options

This module will wrap any kind of Net::Server, for instance a Net::Server::PreFork. It depends on the type of Net::Server you specify (see new(based_on)) which configuration options are available on the command-line, in a configuration file, or with run(). Each daemon extension implementation will add some configuration options as well.

Any XML::Compile::SOAP::Daemon::NetServer object will have the following additional configuration options:

Key             Value             Default
client_timeout  integer seconds   30
client_maxreq   integer           100
client_reqbonus integer seconds   0
name            string            "soap daemon"

Some general configuration options of Net::Server have a different default. See also the next section about logging.

Key             Value             New default
setsid          boolean           true
background      boolean           true

For each client, we like to have a reset of the connection after some time, for two reasons: perl processes are usually leaking memory a bit so should not live for ever, and you can experience denial of service attacks. The client_timeout value details the number of seconds a connection may live, but that will be increase by client_reqbonus for every received message. In any case, after client_maxreq messages were handled, the connection will be terminated.

The name is included in the reply messages.

logging

An attempt is made to merge XML::Compile's Log::Report and Net::Server log configuration. By hijacking the log() method, all Net::Server internal errors are dispatched over the Log::Report framework. Log levels are translated into report reasons: 0=ERROR, 1=WARNING, 2=NOTICE, 3=INFO, 4=TRACE.

When you specify Sys::Syslog or a filename, default dispatchers of type SYSLOG resp FILE are created for you. When the log_file type is set to Log::Report, you have much more control over the process, but all log related configuration options will get ignored. In that case, you must have initialized the dispatcher framework the way Log::Report is doing it: before the daemon is initiated. See Log::Report subroutine dispatcher.

Key          Value                            Default
log_file     filename|Sys::Syslog|Log::Report Log::Report
log_level    0..4 | REASON                    2 (NOTICE)

SEE ALSO

This module is part of XML-Compile-SOAP-Daemon distribution version 3.01, built on February 13, 2012. Website: http://perl.overmeer.net/xml-compile/

Other distributions in this suite: XML::Compile, XML::Compile::SOAP, XML::Compile::SOAP12, XML::Compile::SOAP::Daemon, XML::Compile::SOAP::WSA, XML::Compile::C14N, XML::Compile::WSS, XML::Compile::Tester, XML::Compile::Cache, XML::Compile::Dumper, XML::Compile::RPC, XML::Rewrite, XML::eXistDB, and XML::LibXML::Simple.

Please post questions or ideas to the mailinglist at http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/xml-compile For live contact with other developers, visit the #xml-compile channel on irc.perl.org.

LICENSE

Copyrights 2007-2012 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 http://www.perl.com/perl/misc/Artistic.html