NAME
SOAP::Transport::HTTP::MockReplay - Mock HTTP client layer for SOAP::Lite
SYNOPSIS
# Thsi module has to be loaded *BEFORE* SAOAP::Lite
use SOAP::Transport::HTTP::MockReplay;
use SOAP::Lite;
my $client = SOAP::Lite->new(proxy => $endpoint);
$client->call($method => @arguments);
DESCRIPTION
This module records all SOAP rquests and responses to a locale cache on disk. The requests can then be mocked (played back) from the cache.
This can be of great help when using complex web services that return unexpected messages and can be hard to troubleshoot. Or when using services that are paying (ex: Google AdWords) and where invoking a service is costly.
CACHE
The cache consists simply of a folder where the requestes and responses are both saved in the same subfolder. The subfolder is named after the MD5 of the request's contents. This allows the module to quicky find a response when performing a playback.
API
import
This module can be configured through the import mechanism.
To change the name of the logger (soap.mock) used simply provide a name through the parameter logger:
use SOAP::Transport::HTTP::MockReplay logger => 'app.soap';
To use a different cache folder (soap-cache) provide a new value through the parameter cache:
use SOAP::Transport::HTTP::MockReplay cache => '.soap/mock/';
To write the files with a IO layer mode other than ':utf8' use binmode:
use SOAP::Transport::HTTP::MockReplay binmode => ':raw';
Of course all these options can be combined together.
AUTHOR
Emmanuel Rodriguez <potyl@cpan.org>
COPYRIGHT
(C) 2010 Emmanuel Rodriguez