import SOAP-WSDL 2.00_29 from CPAN

git-cpan-module:   SOAP-WSDL
git-cpan-version:  2.00_29
git-cpan-authorid: MKUTTER
git-cpan-file:     authors/id/M/MK/MKUTTER/SOAP-WSDL-2.00_29.tar.gz
This commit is contained in:
Martin Kutter authored and Michael G. Schwern committed 2009-12-12 19:48:17 -08:00
1 parent 2bad767211
commit 874251225f
402 files changed
+30230 -2406

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
use strict;
use warnings;
use Test::More tests => 3;
use_ok qw(SOAP::WSDL::Expat::Base);
my $parser = SOAP::WSDL::Expat::Base->new();
eval { $parser->parse('Foobar')};
ok $@;
eval { $parser->parsefile('Foobar')};
ok $@;
+85
View File
@@ -0,0 +1,85 @@
#!/usr/bin/perl -w
use strict;
use warnings;
use Test::More tests => 4;
use lib '../../../../lib';
use lib '../../../../t/lib';
use lib 't/lib';
use lib '../lib';
use lib 'lib';
use_ok(qw/SOAP::WSDL::Expat::MessageParser/);
use MyComplexType;
use MyElement;
use MySimpleType;
my $xml = q{<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" >
<SOAP-ENV:Body><MyAtomicComplexTypeElement xmlns="urn:Test" >
<test>Test</test>
<test2 >Test2</test2>
<foo><bar></bar><baz></baz></foo>
</MyAtomicComplexTypeElement></SOAP-ENV:Body></SOAP-ENV:Envelope>};
my $parser = SOAP::WSDL::Expat::MessageParser->new({
class_resolver => 'FakeResolver'
});
$parser->parse( $xml );
is $parser->get_data(), q{<MyAtomicComplexTypeElement xmlns="urn:Test">}
. q{<test>Test</test><test2>Test2</test2></MyAtomicComplexTypeElement>}
, 'Content comparison';
my $xml_attr = q{<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" >
<SOAP-ENV:Body><MyElementAttrs xmlns="urn:Test" test="Test" test2="Test2">
<test>Test</test>
<test2 >Test2</test2>
</MyElementAttrs></SOAP-ENV:Body></SOAP-ENV:Envelope>};
$parser->parse($xml_attr);
is $parser->get_data(),
q{<MyElementAttrs xmlns="urn:Test" test="Test" test2="Test2"><test>Test</test><test2>Test2</test2></MyElementAttrs>},
'Content with attributes';
my $xml_error = q{<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" >
<SOAP-ENV:Body><MyElementAttrs xmlns="urn:Test" test="Test" test2="Test2">
<test>Test</test>
<test2 >Test2</test2>
<foo>Bar</foo>
</MyElementAttrs></SOAP-ENV:Body></SOAP-ENV:Envelope>};
eval { $parser->parse($xml_error) };
like $@, qr{\A Cannot \s resolve \s class \s for \s MyElementAttrs/foo }x, 'XML error';
# data classes reside in t/lib/Typelib/
BEGIN {
package FakeResolver;
{
my %class_list = (
'MyAtomicComplexTypeElement' => 'MyAtomicComplexTypeElement',
'MyAtomicComplexTypeElement/test' => 'MyTestElement',
'MyAtomicComplexTypeElement/test2' => 'MyTestElement2',
'MyAtomicComplexTypeElement/foo' => '__SKIP__',
# 'MyAtomicComplexTypeElement/foo/bar' => 'MyFooElement',
# 'MyAtomicComplexTypeElement/foo/baz' => 'MyFooElement',
'MyElementAttrs' => 'MyElementAttrs',
'MyElementAttrs/test' => 'MyTestElement',
'MyElementAttrs/test2' => 'MyTestElement2',
);
sub new { return bless {}, 'FakeResolver' };
sub get_typemap { return \%class_list };
sub get_class {
my $name = join('/', @{ $_[1] });
return ($class_list{ $name }) ? $class_list{ $name }
: undef;
};
};
};
+53
View File
@@ -0,0 +1,53 @@
use strict;
use warnings;
use Test::More tests => 4; #qw(no_plan);
use File::Spec;
use File::Basename;
my $path = File::Spec->rel2abs( dirname __FILE__ );
use_ok qw( SOAP::WSDL::Expat::WSDLParser);
my $parser = SOAP::WSDL::Expat::WSDLParser->new();
my $definitions = $parser->parse_file(
"$path/../../../acceptance/wsdl/WSDLParser.wsdl"
);
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');
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",
});
my $code = "";
$generator->set_output(\$code);
$generator->generate_typelib();
{
eval $code;
ok !$@;
print $@ if $@;
}
# print $code;
__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();