| 1 |
use Test::More tests => 9; |
| 2 |
use strict; |
| 3 |
use warnings; |
| 4 |
use File::Basename; |
| 5 |
use SOAP::WSDL::Client; |
| 6 |
|
| 7 |
my $soap; |
| 8 |
my $base_dir = dirname( __FILE__ ); |
| 9 |
use_ok(qw/SOAP::WSDL::Transport::Test/); |
| 10 |
|
| 11 |
$soap = SOAP::WSDL::Client->new(); |
| 12 |
$soap->set_proxy('http://somewhere.over.the.rainbow'); |
| 13 |
|
| 14 |
$soap->get_transport->set_base_dir( join '/', $base_dir, 'acceptance' ); |
| 15 |
ok $soap->get_transport->get_base_dir(); |
| 16 |
|
| 17 |
{ |
| 18 |
local $SIG{__WARN__} = sub {}; |
| 19 |
my $response = $soap->call({ operation => 'test', soap_action => 'http://test' }, {}); |
| 20 |
ok ! $response, 'Returned fault on error'; |
| 21 |
is $response->get_faultcode(), 'soap:Server', 'faultcode'; |
| 22 |
is $response->get_faultactor(), 'urn:localhost', 'faultactor'; |
| 23 |
|
| 24 |
$soap->outputxml(1); |
| 25 |
$response = $soap->call({ operation => 'test', soap_action => 'http://test2' }, {}); |
| 26 |
is $response, 'test2', 'Returned file content'; |
| 27 |
|
| 28 |
} |
| 29 |
|
| 30 |
SKIP: { |
| 31 |
eval { require SOAP::WSDL::Deserializer::SOM; } |
| 32 |
or skip 'SOAP::WSDL::Deserializer::SOM required', 3; |
| 33 |
# requre SOAP::WSDL::Factory::Deserializer; |
| 34 |
SOAP::WSDL::Factory::Deserializer->register('1.1', 'SOAP::WSDL::Deserializer::SOM'); |
| 35 |
|
| 36 |
my $soap_som = SOAP::WSDL::Client->new(); |
| 37 |
$soap_som->set_proxy('http://somewhere.over.the.rainbow'); |
| 38 |
$soap_som->get_transport->set_base_dir( join '/', $base_dir, 'acceptance' ); |
| 39 |
|
| 40 |
my $som; |
| 41 |
ok $som = $soap_som->call({ operation => 'test', soap_action => 'http://test3' }, {}) |
| 42 |
, 'Call with SOAP::WSDL::Deserializer::SOM'; |
| 43 |
|
| 44 |
# In the somewhat weird logic of SOAP::Lite, the first node inside the root element |
| 45 |
# is the reault, all others are output parameters (and may be accessed via "paramsout") |
| 46 |
is $som->result(), 'Munich', 'Result match'; |
| 47 |
is $som->paramsout(), 'Germany' , 'Output parameter match'; |
| 48 |
} |
| 49 |
|