import SOAP-WSDL 2.00_14 from CPAN

git-cpan-module:   SOAP-WSDL
git-cpan-version:  2.00_14
git-cpan-authorid: MKUTTER
git-cpan-file:     authors/id/M/MK/MKUTTER/SOAP-WSDL-2.00_14.tar.gz
This commit is contained in:
Martin Kutter
2009-12-12 19:47:53 -08:00
committed by Michael G. Schwern
parent f63138fc87
commit 099c83b6bc
21 changed files with 488 additions and 131 deletions
+44
View File
@@ -0,0 +1,44 @@
use Test::More tests => 9;
use strict;
use warnings;
use File::Basename;
use SOAP::WSDL::Client;
my $soap;
my $base_dir = dirname( __FILE__ );
use_ok(qw/SOAP::WSDL::Transport::Test/);
$soap = SOAP::WSDL::Client->new();
$soap->set_proxy('http://somewhere.over.the.rainbow');
ok( $soap->get_transport->set_base_dir( join '/', $base_dir, 'acceptance' ) );
my $response = $soap->call({ operation => 'test', soap_action => 'http://test' }, {});
ok ! $response, 'Returned fault on error';
is $response->get_faultcode(), 'soap:Server', 'faultcode';
is $response->get_faultactor(), 'urn:localhost', 'faultactor';
$soap->outputxml(1);
$response = $soap->call({ operation => 'test', soap_action => 'http://test2' }, {});
is $response, 'test2', 'Returned file content';
SKIP: {
eval { require SOAP::WSDL::Deserializer::SOM; }
or skip 'SOAP::WSDL::Deserializer::SOM required', 3;
# requre SOAP::WSDL::Factory::Deserializer;
SOAP::WSDL::Factory::Deserializer->register('1.1', 'SOAP::WSDL::Deserializer::SOM');
my $soap_som = SOAP::WSDL::Client->new();
$soap_som->set_proxy('http://somewhere.over.the.rainbow');
$soap_som->get_transport->set_base_dir( join '/', $base_dir, 'acceptance' );
my $som;
ok $som = $soap_som->call({ operation => 'test', soap_action => 'http://test3' }, {})
, 'Call with SOAP::WSDL::Deserializer::SOM';
# In the somewhat weird logic of SOAP::Lite, the first node inside the root element
# is the reault, all others are output parameters (and may be accessed via "paramsout")
is $som->result(), 'Munich', 'Result match';
is $som->paramsout(), 'Germany' , 'Output parameter match';
}
@@ -0,0 +1 @@
test2
@@ -0,0 +1 @@
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" ><SOAP-ENV:Body><GetWeatherResponse xmlns="http://www.webserviceX.NET"><CityName>Munich</CityName><CountryName>Germany</CountryName></GetWeatherResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
@@ -0,0 +1,20 @@
use strict;
use warnings;
use Test::More qw(no_plan);
use Scalar::Util qw(blessed);
use lib '../../../../../../lib';
use_ok qw(SOAP::WSDL::XSD::Typelib::Builtin::anyType);
my $obj = SOAP::WSDL::XSD::Typelib::Builtin::anyType->new({
xmlns => 'urn:Siemens.mosaic'
});
ok blessed $obj, 'constructor returned blessed reference';
ok $obj->set_xmlns('urn:SOAP-WSDL'), 'set_xmlns';
is $obj->get_xmlns(), 'urn:SOAP-WSDL', 'get_xmlns';
is $obj->start_tag({ name => 'test' }), '<test >', 'start_tag';
is $obj->end_tag({ name => 'test' }), '</test >', 'end_tag';
is "$obj", q{}, 'serialize overloading';
@@ -0,0 +1,44 @@
use strict;
use warnings;
use Test::More qw(no_plan);
use Scalar::Util qw(blessed);
use lib '../../../../../../lib';
use_ok qw(SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType);
my $obj = SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType->new({});
ok $obj->set_xmlns('urn:SOAP-WSDL'), 'set_xmlns';
is $obj->get_xmlns(), 'urn:SOAP-WSDL', 'get_xmlns';
ok blessed $obj, 'constructor returned blessed reference';
is $obj->start_tag({ name => 'test' }), '<test >', 'start_tag';
is $obj->end_tag({ name => 'test' }), '</test >', 'end_tag';
ok $obj->set_value('test'), 'set_value';
is $obj->get_value(), 'test', 'get_value';
is "$obj", q{test}, 'serialize overloading';
ok ($obj)
? pass 'boolean overloading'
: fail 'boolean overloading';
ok ! $obj->set_value(undef), 'set_value with explicit undef';
is $obj->get_value(), undef, 'get_value';
is "$obj", q{}, 'stringification overloading';
ok $obj = SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType->new({
xmlns => 'urn:XSD',
value => 'test2',
});
is $obj->get_xmlns(), 'urn:XSD', 'get_xmlns on attr value';
is $obj->get_value(), 'test2', 'get_value on attr value';
$obj->set_value(undef);
is $obj->serialize({ name => 'foo' }), '<foo ></foo >'
, 'serialize undef value with name';
is $obj->serialize(), q{}, 'serialize undef value without name'