import SOAP-WSDL 2.00.10 from CPAN

git-cpan-module:   SOAP-WSDL
git-cpan-version:  2.00.10
git-cpan-authorid: MKUTTER
git-cpan-file:     authors/id/M/MK/MKUTTER/SOAP-WSDL-2.00.10.tar.gz
This commit is contained in:
Martin Kutter
2009-12-12 19:49:03 -08:00
committed by Michael G. Schwern
parent 3b30e8d0e2
commit 9023aa06a4
97 changed files with 895 additions and 375 deletions
+70 -40
View File
@@ -1,66 +1,96 @@
package FaultDeserializer;
use strict;
use warnings;
use Test::More tests => 15;
use SOAP::WSDL::SOAP::Typelib::Fault11;
sub new { bless {}, shift }
sub deserialize {
die SOAP::WSDL::SOAP::Typelib::Fault11->new( {} );
}
package main;
use strict;
use warnings;
use Test::More tests => 16;
use SOAP::WSDL::Transport::Loopback;
use Scalar::Util qw(blessed);
use_ok qw(SOAP::WSDL::Client);
{
no warnings qw(redefine once);
*SOAP::WSDL::Factory::Transport::get_transport = sub {
my ($self, $url , %args_of) = @_;
my ( $self, $url, %args_of ) = @_;
if (%args_of) {
is $args_of{foo}, 'bar';
}
};
}
ok my $client = SOAP::WSDL::Client->new();
ok $client = SOAP::WSDL::Client->new({
proxy => 'http://localhost',
});
sub test_client_basics {
ok my $client = SOAP::WSDL::Client->new();
ok $client = SOAP::WSDL::Client->new( {proxy => 'http://localhost',} );
is $client->get_content_type(), 'text/xml; charset=utf-8';
is $client->get_endpoint(), 'http://localhost';
$client->set_proxy( 'http://localhost', foo => 'bar', );
is $client->get_content_type(), 'text/xml; charset=utf-8';
#TODO is this behaviour still required? declare as deprecated and remove...
$client->set_proxy( ['http://localhost', foo => 'bar',] );
is $client->get_endpoint(), 'http://localhost';
is $client->get_proxy(), $client->get_transport(),
'get_proxy returns same as get_transport';
$client->set_proxy('http://localhost',
foo => 'bar',
);
ok $client->set_soap_version('1.1');
is $client->get_soap_version(), '1.1';
#TODO is this behaviour still required? declare as deprecated and remove...
$client->set_proxy(
[ 'http://localhost',
foo => 'bar',
]
);
$client->set_deserializer_args( {strict => 0} );
is $client->get_deserializer_args()->{strict}, 0;
}
sub test_call {
my $client = SOAP::WSDL::Client->new();
$client->no_dispatch(1);
$client->set_serializer('main');
my $serialize = $client->call(
{operation => 'testMethod'},
{foo => 'bar'},
{bar => 'baz'} );
is $serialize->{body}->{foo}, 'bar';
is $serialize->{header}->{bar}, 'baz';
is $client->get_proxy(), $client->get_transport(), 'get_proxy returns same as get_transport';
# Old calling style compatibility test - foo => bar is body...
$serialize = $client->call( {operation => 'testMethod'}, foo => 'bar' );
is $serialize->{body}->{foo}, 'bar';
ok $client->set_soap_version('1.1');
is $client->get_soap_version(), '1.1';
$client->no_dispatch(1);
$client->set_serializer('main');
my $serialize = $client->call({
operation => 'testMethod'
}, { foo => 'bar'}, { bar => 'baz'});
is $serialize->{ body }->{ foo }, 'bar';
is $serialize->{ header }->{ bar }, 'baz';
# Old calling style compatibility test - foo => bar is body...
$serialize = $client->call({
operation => 'testMethod'
}, foo => 'bar');
is $serialize->{ body }->{ foo }, 'bar';
# Old calling style compatibility test - foo => bar is body...
$serialize = $client->call('testMethod', foo => 'bar');
is $serialize->{ body }->{ foo }, 'bar';
# Old calling style compatibility test - foo => bar is body...
$serialize = $client->call( 'testMethod', foo => 'bar' );
is $serialize->{body}->{foo}, 'bar';
}
sub serialize {
my $self = shift;
return shift;
}
$client->set_deserializer_args({ strict => 0 });
is $client->get_deserializer_args()->{ strict }, 0;
sub test_deserializer_fault {
my $client = SOAP::WSDL::Client->new();
$client->set_deserializer( FaultDeserializer->new() );
$client->set_transport( SOAP::WSDL::Transport::Loopback->new() );
my $fault = $client->call(
{operation => 'testMethod'},
{foo => 'bar'},
{bar => 'baz'} );
ok( (blessed $fault and $fault->isa('SOAP::WSDL::SOAP::Typelib::Fault11')),
'Return fault on throwing during deserialization ' . $@);
}
test_client_basics();
test_call();
test_deserializer_fault();
+3 -1
View File
@@ -1,4 +1,4 @@
use Test::More tests => 14;
use Test::More tests => 15;
use File::Basename qw(dirname);
use File::Spec;
use File::Path;
@@ -63,6 +63,8 @@ use_ok qw(MyInterfaces::My::SOAP::testService::testPort);
use_ok qw(MyServer::My::SOAP::testService::testPort);
use_ok qw(MyTypes::testComplexTypeRestriction);
use_ok qw(MyTypes::testComplexTypeAll);
# type with dot in name including atomic type
use_ok qw(MyTypes::test::ComplexTypeElementAtomicSimpleType);
SKIP: {
eval { require Test::Pod::Content; }
or skip 'Cannot test pod content without Test::Pod::Content', 6;
+11 -9
View File
@@ -73,16 +73,18 @@ __PACKAGE__->_factory(
);
package MyElementSimpleContent;
use base qw(
SOAP::WSDL::XSD::Typelib::Element
SOAP::WSDL::XSD::Typelib::ComplexType
SOAP::WSDL::XSD::Typelib::Builtin::string
);
{
use base qw(
SOAP::WSDL::XSD::Typelib::Element
SOAP::WSDL::XSD::Typelib::ComplexType
SOAP::WSDL::XSD::Typelib::Builtin::string
);
__PACKAGE__->__set_name( 'MyElementSimpleContent' );
sub __get_attr_class { 'MyElement::_ATTR' };
__PACKAGE__->__set_name( 'MyElementSimpleContent' );
sub __get_attr_class { 'MyElement::_ATTR' };
sub get_xmlns { 'http://www.w3.org/2001/XMLSchema' }
}
package main;
use Test::More tests => 127;
use Storable;
@@ -392,4 +394,4 @@ ok ! exists $obj->as_hash_ref(1)->{ xmlattr };
local $SOAP::WSDL::XSD::Typelib::ComplexType::AS_HASH_REF_WITHOUT_ATTRIBUTES = 1;
ok ! exists $obj->as_hash_ref()->{ xmlattr };
ok ! exists $obj->as_hash_ref(1)->{ xmlattr };
}
}