=head1 NAME

XML::Compile::SOAP::Tester - test SOAP without daemon

=head1 INHERITANCE

=head1 SYNOPSIS

 # Do this BEFORE the client SOAP handlers are compiled!
 use XML::Compile::SOAP::Tester ();
 my $tester = XML::Compile::SOAP::Tester->new(@options);

 my $action = pack_type $my_ns, 'GetStockPrice';
 sub get_stock_price(@) {...}

 #
 # with WSDL
 #

 use XML::Compile::WSDL11 ();
 my $wsdl    = XML::Compile::WSDL11->new('my_wsdl.xml');
 my $call    = $wsdl->compileClient($action);
 $tester->fromWSDL($wsdl);
 $tester->addCallback($action, \&get_stock_price);

 my $answer  = $call->($query);

 #
 # without WSDL
 #

 use XML::Compile::Util   'pack_type';
 use XML::Compile::SOAP11::Client ();
 use XML::Compile::SOAP11::Server ();

 my $client = XML::Compile::SOAP11::Client->new;
 my $call   = $client->compileRequest(...);

 my $server = XML::Compile::SOAP11::Server->new;
 my $answer = $server->compileAnswer(  ... \&get_stock_price);
 $tester->actionCallback($my_action, $answer, $server);

 my $answer = $call->($query);

=head1 DESCRIPTION

Once you have instantiated this object, all compiled client calls
will get re-routed to methods within the object.  This is useful
for debugging and regression tests.

If you install the XML-Compile-SOAP-Server distribution, you will
have an L<XML::Compile::SOAP::HTTPTester|XML::Compile::SOAP::HTTPTester> implementation, which
simulates a remote server in a much more realistic way.

=head1 METHODS

XML::Compile::SOAP::Tester-E<gt>B<new>(OPTIONS)

=over 4

 Option   --Default
 callbacks  {}

. callbacks => HASH | ARRAY

=over 4

The HASH contains pairs of action-uri to code reference.  Each pair
is used to call L<actionCallback()|XML::Compile::SOAP::Tester/"Attributes">.  The ARRAY contains two elements:
a string C<SOAP11>, C<SOAP12>, or L<XML::Compile::SOAP|XML::Compile::SOAP> object as
first, and the HASH as second.  To be precise: when only a HASH is
passed, it is the same as an ARRAY with C<ANY> and that HASH.

=back

=back

=head2 Attributes

$obj-E<gt>B<actionCallback>(ACTION, CODE, ['SOAP11'|'SOAP12'|SOAP|'ANY'])

=over 4

Change the callback of an ACTION to the CODE reference.  By default,
all known (ANY) soap versions will be affected.  Callback changes to
undefined actions are ignored.

=back

=head2 Run the server

$obj-E<gt>B<request>(OPTIONS)

=over 4

Fake a request to a remote server.  Which information is passed as
the OPTIONS depends partially on the protocol.

=back

=head1 SEE ALSO

This module is part of XML-Compile-SOAP distribution version 0.67,
built on February 08, 2008. Website: F<http://perl.overmeer.net/xml-compile/>

=head1 LICENSE

Copyrights 2007-2008 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>

