import SOAP-WSDL 2.00.02 from CPAN

git-cpan-module:   SOAP-WSDL
git-cpan-version:  2.00.02
git-cpan-authorid: MKUTTER
git-cpan-file:     authors/id/M/MK/MKUTTER/SOAP-WSDL-2.00.02.tar.gz
This commit is contained in:
Martin Kutter authored and Michael G. Schwern committed 2009-12-12 19:48:35 -08:00
1 parent 745ce925c1
commit 915ee03cbe
153 files changed
+3289 -2513

No files matched your search

+42 -22
View File
@@ -1,10 +1,12 @@
use strict;
use warnings;
use Test::More tests => 11; #qw(no_plan);
use Test::More tests => 14; #qw(no_plan);
use File::Spec;
use File::Basename;
my $path = File::Spec->rel2abs( dirname __FILE__ );
$path =~s{\\}{/}xg; # stupid windows workaround: $path works with /, but not
# with \
use_ok qw( SOAP::WSDL::Expat::WSDLParser);
@@ -17,18 +19,18 @@ my $definitions = $parser->parse_file(
use Data::Dumper;
my $schema = $definitions->first_types()->get_schema()->[1];
my $attr = $schema->get_element()->[0]->first_complexType->first_attribute();
ok $attr->get_name('testAttribute');
ok $attr->get_type('xs:string');
ok $attr->get_name('testAttribute'), 'attribute name';
ok $attr->get_type('xs:string'), 'attribute type';
use SOAP::WSDL::Generator::Template::XSD;
my $generator = SOAP::WSDL::Generator::Template::XSD->new({
definitions => $definitions,
type_prefix => 'Foo',
element_prefix => 'Foo',
typemap_prefix => 'Foo',
OUTPUT_PATH => "$path/testlib",
});
#use SOAP::WSDL::Generator::Template::XSD;
#my $generator = SOAP::WSDL::Generator::Template::XSD->new({
# definitions => $definitions,
# type_prefix => 'Foo',
# element_prefix => 'Foo',
# typemap_prefix => 'Foo',
# OUTPUT_PATH => "$path/testlib",
#});
$definitions = $parser->parse_uri(
"file://$path/../../../acceptance/wsdl/WSDLParser-import.wsdl"
@@ -43,6 +45,35 @@ is @{ $schema_from_ref }, 2, 'got builtin and imported schema';
ok @{ $schema_from_ref->[1]->get_element } > 0;
is $schema_from_ref->[1]->get_element->[0]->get_name(), 'sayHello';
{
my $warn_parser = SOAP::WSDL::Expat::WSDLParser->new();
my $warning;
local $SIG{__WARN__} = sub { $warning = join(q{}, @_ )};
$definitions = $warn_parser->parse_file(
"$path/../../../acceptance/wsdl/WSDLParser/import_no_location.wsdl"
);
like $warning, qr{cannot \s import \s document \s for \s namespace \s >urn:Test< \s without \slocation}x
, 'warn on import without location';
$definitions = $warn_parser->parse_uri(
"file://$path/../../../acceptance/wsdl/WSDLParser/xsd_import_no_location.wsdl"
);
like $warning, qr{cannot \s import \s document \s for \s namespace \s >urn:Test< \s without \slocation}x
, 'warn on import without location';
};
eval {
my $warn_parser = SOAP::WSDL::Expat::WSDLParser->new();
$definitions = $warn_parser->parse_file(
"$path/../../../acceptance/wsdl/WSDLParser/import_xsd_cascade.wsdl"
);
};
like $@, qr{\A cannot \s import \s document \s from \s namespace \s
>urn:Test< \s without \s base \s uri\. \s
Use \s >parse_uri< \s or \s >set_uri< \s to \s set \s one\.}x;
# Alarm is just to be sure - may loop infinitely if broken
$SIG{ALRM} = sub { die 'looped'};
alarm 1;
@@ -52,14 +83,3 @@ $definitions = $parser->parse_file(
alarm 0;
pass 'import loop';
__END__
$generator->set_type_prefix('MyTypes');
$generator->set_element_prefix('MyElements');
$generator->set_typemap_prefix('MyTypemaps');
$generator->set_interface_prefix('MyInterfaces');
$generator->set_output(undef);
$generator->generate();