Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
XML::Compile::SOAP::DaUser:ContributedXPL::Compile::SOAP::Daemon::AnyDaemon(3)

NAME
       XML::Compile::SOAP::Daemon::AnyDaemon - SOAP server based on
       Any::Daemon

INHERITANCE
	XML::Compile::SOAP::Daemon::AnyDaemon
	  is a XML::Compile::SOAP::Daemon

	XML::Compile::SOAP::Daemon::AnyDaemon
	  is an	Any::Daemon

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

	my $daemon  = XML::Compile::SOAP::Daemon::AnyDaemon->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
       Any::Daemon as daemon implementation. It	is a simple pre-forked daemon,
       much easier than	the Net::Server	implementations.

       We use HTTP::Daemon as HTTP-connection implementation. The
       HTTP::Request and HTTP::Response	objects	(provided by "HTTP-Message")
       are handled 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.

       Extends "DESCRIPTION" in	XML::Compile::SOAP::Daemon.

METHODS
       Extends "METHODS" in XML::Compile::SOAP::Daemon.

   Constructors
       Extends "Constructors" in XML::Compile::SOAP::Daemon.

       XML::Compile::SOAP::Daemon::AnyDaemon->new(%options)
	   Create the server handler, which extends some class which
	   implements a	Net::Server daemon.

	   As %options,	you can	pass everything	accepted by Any::Daemon
	   subroutine new, like	"pid_file", "user", "group", and "workdir",

	    -Option	       --Defined in		   --Default
	     accept_slow_select	 XML::Compile::SOAP::Daemon  <true>
	     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
	   output_charset => STRING
	   soap_action_input =>	HASH|ARRAY
	   wsa_action_input => HASH|ARRAY
	   wsa_action_output =>	HASH|ARRAY

   Attributes
       Extends "Attributes" in XML::Compile::SOAP::Daemon.

       $obj->addSoapAction(HASH|PAIRS)
	   Inherited, see "Attributes" in XML::Compile::SOAP::Daemon

       $obj->addWsaTable( <'INPUT'|'OUTPUT'>, [HASH|PAIRS] )
	   Inherited, see "Attributes" in XML::Compile::SOAP::Daemon

       $obj->outputCharset()
	   Inherited, see "Attributes" in XML::Compile::SOAP::Daemon

   Running the server
       Extends "Running	the server" in XML::Compile::SOAP::Daemon.

       $obj->process($client, $xmlin, $request,	$action)
	   Inherited, see "Running the server" in XML::Compile::SOAP::Daemon

       $obj->run(%options)
	    -Option	    --Default
	     background	      <true>
	     child_init	      undef
	     client_maxreq    100
	     client_reqbonus  0
	     client_timeout   30
	     host	      undef
	     listen	      SOMAXCONN
	     max_childs	      10
	     port	      undef
	     postprocess      undef
	     server_name      undef
	     socket	      undef

	   background => BOOLEAN
	   child_init => CODE
	     This CODE reference will get called by each child which gets
	     started, before the "accept" waiting starts.  Ideal moment	to
	     start your	database-connection.

	   client_maxreq => NUMBER
	     Maximum number of requests	per connection.

	   client_reqbonus => SECONDS
	     Time to add to the	timeout	as bonus per handled client request.
	     Fast clients get more time	over slow clients, more	time to	reach
	     their maximum number of requests.

	   client_timeout => SECONDS
	     The maximum time a	connection may exist, before being terminated.

	   host	=> STRING
	     Ignored when a socket is provided,	otherwise required.

	   listen => INTEGER
	     Ignored when a socket is provided.

	   max_childs => INTEGER
	   port	=> INTEGER
	     Ignored when a socket is provided,	otherwise required.

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

	   server_name => STRING
	   socket => SOCKET
	     Pass your own socket, in stead of having one created for you. The
	     SOCKET must be an "IO::Socket::INET" (or compatible like
	     IO::Socket::SSL and IO::Socket::IP)

   Preparations
       Extends "Preparations" in XML::Compile::SOAP::Daemon.

       $obj->addHandler($name, $soap, CODE)
	   Inherited, see "Preparations" in XML::Compile::SOAP::Daemon

       $obj->operationsFromWSDL($wsdl, %options)
	   Inherited, see "Preparations" in XML::Compile::SOAP::Daemon

       $obj->setWsdlResponse( $filename, [$filetype] )
	   Inherited, see "Preparations" in XML::Compile::SOAP::Daemon

   Helpers
       Extends "Helpers" in XML::Compile::SOAP::Daemon.

       $obj->faultInvalidXML($error)
	   Inherited, see "Helpers" in XML::Compile::SOAP::Daemon

       $obj->faultNotSoapMessage($nodetype)
	   Inherited, see "Helpers" in XML::Compile::SOAP::Daemon

       $obj->faultUnsupportedSoapVersion($env_ns)
	   Inherited, see "Helpers" in XML::Compile::SOAP::Daemon

       $obj->handlers( <'SOAP11'|'SOAP12'|$soap> )
	   Inherited, see "Helpers" in XML::Compile::SOAP::Daemon

       $obj->printIndex( [$fh] )
	   Inherited, see "Helpers" in XML::Compile::SOAP::Daemon

       $obj->soapVersions()
	   Inherited, see "Helpers" in XML::Compile::SOAP::Daemon

DETAILS
       Extends "DETAILS" in XML::Compile::SOAP::Daemon.

   Operation handlers
       Extends "Operation handlers" in XML::Compile::SOAP::Daemon.

   Returning errors
       Extends "Returning errors" in XML::Compile::SOAP::Daemon.

   AnyDaemon with SSL
       First, create certificates and let them be signed by a CA (or yourself)
       See http://devsec.org/info/ssl-cert.html	to understand this.

	 # generate secret private key
	 openssl genrsa	-out privkey.pem 1024

	 # create a "certification request" (CSR)
	 openssl req -new -key privkey.pem -out	certreq.csr

	 # send	the CSR	to the Certification Authority or self-sign:
	 openssl x509 -req -days 3650 -in certreq.csr -signkey privkey.pem -out	newcert.pem

	 # publish server certificate
	 ( openssl x509	-in newcert.pem; cat privkey.pem ) > server.pem
	 ln -s server.pem `openssl x509	-hash -noout -in server.pem`.0	 # dot-zero

       Assuming	that the certificates are in 'certs/', the program looks like
       this:

	 use Log::Report;
	 use XML::Compile::SOAP::Daemon::AnyDaemon;
	 use XML::Compile::WSDL11;
	 use IO::Socket::SSL	   'SSL_VERIFY_NONE';
	 use IO::Socket		   'SOMAXCONN';

	 my $daemon = XML::Compile::SOAP::Daemon::AnyDaemon->new;
	 my $wsdl   = XML::Compile::WSDL11->new($wsdl);

	 my %handlers =	();
	 $daemon->operationsFromWSDL($wsdl, callbacks => \%handlers);

	 my $socket = IO::Socket::SSL->new
	  ( LocalHost  => 'localhost'
	  , LocalPort  => 4444
	  , Listen     => SOMAXCONN
	  , Reuse      => 1
	  , SSL_server => 1
	  , SSL_verify_mode => SSL_VERIFY_NONE
	  , SSL_key_file    => 'certs/privkey.pem'
	  , SSL_cert_file   => 'certs/server.pem'
	  ) or error __x"cannot	create socket at {interface}: {err}"
		, interface => "$host:$port"
		, err => IO::Socket::SSL::errstr();

	 $daemon->run
	  ( name       => basename($0)
	  , max_childs => 1
	  , socket     => $socket
	  , child_init => \&for_instance_connect_to_db
	  )

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

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 http://dev.perl.org/licenses/

perl v5.32.0			  2018XML::Compile::SOAP::Daemon::AnyDaemon(3)

NAME | INHERITANCE | SYNOPSIS | DESCRIPTION | METHODS | DETAILS | SEE ALSO | LICENSE

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=XML::Compile::SOAP::Daemon::AnyDaemon&sektion=3&manpath=FreeBSD+12.2-RELEASE+and+Ports>

home | help