import SOAP-WSDL 1.27 from CPAN
git-cpan-module: SOAP-WSDL git-cpan-version: 1.27 git-cpan-authorid: MKUTTER git-cpan-file: authors/id/M/MK/MKUTTER/SOAP-WSDL-1.27.tar.gz
This commit is contained in:
committed by
Michael G. Schwern
parent
7ca2154ad6
commit
2bad767211
@@ -1,69 +0,0 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More qw(no_plan);
|
||||
use Template;
|
||||
use File::Basename;
|
||||
use File::Spec;
|
||||
use SOAP::WSDL::Expat::WSDLParser;
|
||||
use SOAP::WSDL::Generator::Template::XSD;
|
||||
|
||||
my $path = dirname __FILE__;
|
||||
|
||||
my $parser = SOAP::WSDL::Expat::WSDLParser->new();
|
||||
|
||||
$parser->parse_file("$path/../../../acceptance/wsdl/006_sax_client.wsdl");
|
||||
#"$path/../../../../example/wsdl/globalweather.xml");
|
||||
my $definitions = $parser->get_data();
|
||||
|
||||
my $generator = SOAP::WSDL::Generator::Template::XSD->new({
|
||||
definitions => $definitions,
|
||||
});
|
||||
my $output = q{};
|
||||
|
||||
|
||||
$generator->generate_typemap({
|
||||
NO_POD => 1,
|
||||
output => \$output,
|
||||
});
|
||||
|
||||
ok eval $output;
|
||||
print $@ if $@;
|
||||
|
||||
#print $output;
|
||||
|
||||
$output = q{};
|
||||
$generator->generate_interface({
|
||||
NO_POD => 1,
|
||||
output => \$output,
|
||||
});
|
||||
|
||||
ok eval $output;
|
||||
print $@ if $@;
|
||||
|
||||
|
||||
# print $output;
|
||||
__END__
|
||||
|
||||
my $tt = Template->new(
|
||||
DEBUG => 1,
|
||||
EVAL_PERL => 1,
|
||||
RECURSION => 1,
|
||||
INCLUDE_PATH => "$path/../../../../lib/SOAP/WSDL/Template",
|
||||
);
|
||||
|
||||
foreach my $service (@{ $definitions->get_service }) {
|
||||
my $output;
|
||||
$tt->process( 'Interface.tt', {
|
||||
definitions => $definitions,
|
||||
service => $service,
|
||||
interface_prefix => 'MyInterface',
|
||||
type_prefix => 'MyTypes',
|
||||
TYPE_PREFIX => 'MyTypes',
|
||||
element_prefix => 'MyElement',
|
||||
}, \$output);
|
||||
die $tt->error if $tt->error();
|
||||
|
||||
ok eval $output, 'eval output';
|
||||
|
||||
print $output;
|
||||
};
|
||||
@@ -1,22 +0,0 @@
|
||||
use Test::More tests => 15;;
|
||||
use SOAP::WSDL::Generator::Visitor;
|
||||
|
||||
my $visitor = SOAP::WSDL::Generator::Visitor->new();
|
||||
|
||||
is undef, $visitor->visit_Definitions();
|
||||
is undef, $visitor->visit_Binding();
|
||||
is undef, $visitor->visit_Message();
|
||||
is undef, $visitor->visit_Operation();
|
||||
is undef, $visitor->visit_OpMessage();
|
||||
is undef, $visitor->visit_Part();
|
||||
is undef, $visitor->visit_Port();
|
||||
is undef, $visitor->visit_PortType();
|
||||
is undef, $visitor->visit_Service();
|
||||
is undef, $visitor->visit_SoapOperation();
|
||||
is undef, $visitor->visit_Types();
|
||||
|
||||
# XML Schema stuff
|
||||
is undef, $visitor->visit_XSD_Schema();
|
||||
is undef, $visitor->visit_XSD_ComplexType();
|
||||
is undef, $visitor->visit_XSD_Element();
|
||||
is undef, $visitor->visit_XSD_SimpleType();
|
||||
@@ -1,140 +0,0 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 5;
|
||||
use File::Basename;
|
||||
use File::Spec;
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
|
||||
use_ok qw(SOAP::WSDL::Generator::Visitor::Typemap);
|
||||
|
||||
my $visitor;
|
||||
ok $visitor = SOAP::WSDL::Generator::Visitor::Typemap->new(), 'constructor';
|
||||
|
||||
use SOAP::WSDL::Expat::WSDLParser;
|
||||
|
||||
my $parser = SOAP::WSDL::Expat::WSDLParser->new();
|
||||
|
||||
$parser->parse_file(
|
||||
$path . '/../../../../acceptance/wsdl/'
|
||||
#. '04_element.wsdl'
|
||||
#. '11_helloworld.wsdl'
|
||||
#. '008_complexType.wsdl'
|
||||
. '006_sax_client.wsdl'
|
||||
);
|
||||
|
||||
my $definitions = $parser->get_data();
|
||||
|
||||
$definitions->_accept( $visitor );
|
||||
|
||||
my $typemap = $visitor->get_typemap();
|
||||
is $typemap->{'EnqueueMessage/MMessage/MKeepalive'}, 'MyTypes::TKeepalive', 'content';
|
||||
is $typemap->{'EnqueueMessageResponse'}, 'MyElements::EnqueueMessageResponse', 'content';
|
||||
is $typemap->{'KeepaliveMessageResponse'}, 'MyElements::KeepaliveMessageResponse', 'content';
|
||||
|
||||
sub wsdl {
|
||||
q{<?xml version="1.0" encoding="UTF-8"?>
|
||||
<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
|
||||
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
|
||||
xmlns:s="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:s0="urn:HelloWorld"
|
||||
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
|
||||
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
|
||||
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
|
||||
targetNamespace="urn:HelloWorld"
|
||||
xmlns="http://schemas.xmlsoap.org/wsdl/">
|
||||
<types>
|
||||
<s:schema elementFormDefault="qualified"
|
||||
targetNamespace="urn:HelloWorld">
|
||||
<s:element name="sayHello">
|
||||
<s:complexType>
|
||||
<s:sequence>
|
||||
<s:element minOccurs="0" maxOccurs="1" name="name"
|
||||
type="s:string" />
|
||||
|
||||
<s:element minOccurs="0" maxOccurs="1" name="givenName"
|
||||
type="s:string" nillable="1"/>
|
||||
|
||||
<!-- <s:element minOccurs="0" maxOccurs="1" name="test"
|
||||
type="s0:test2" /> //-->
|
||||
</s:sequence>
|
||||
</s:complexType>
|
||||
</s:element>
|
||||
|
||||
<s:element name="sayHelloResponse">
|
||||
<s:complexType>
|
||||
<s:sequence>
|
||||
<s:element minOccurs="0" maxOccurs="1"
|
||||
name="sayHelloResult" type="s:string" />
|
||||
</s:sequence>
|
||||
</s:complexType>
|
||||
</s:element>
|
||||
|
||||
<s:complexType name="test2">
|
||||
<s:sequence>
|
||||
<s:element minOccurs="0" maxOccurs="1" name="name"
|
||||
type="s:string" />
|
||||
|
||||
<s:element minOccurs="0" maxOccurs="1" name="givenName"
|
||||
type="s:string" />
|
||||
</s:sequence>
|
||||
</s:complexType>
|
||||
|
||||
<s:complexType name="testExtended">
|
||||
<s:extension base="s0:test2">
|
||||
<s:sequence>
|
||||
<s:element minOccurs="0" maxOccurs="1" name="extend"
|
||||
type="s:string" />
|
||||
</s:sequence>
|
||||
</s:extension>
|
||||
</s:complexType>
|
||||
</s:schema>
|
||||
</types>
|
||||
|
||||
<message name="sayHelloSoapIn">
|
||||
<part name="parameters" element="s0:sayHello" />
|
||||
|
||||
<!-- <part name="test1" type="s0:testExtended" />
|
||||
|
||||
<part name="test2" type="s0:test2"
|
||||
targetNamespace="urn:test2" /> //-->
|
||||
</message>
|
||||
|
||||
<message name="sayHelloSoapOut">
|
||||
<part name="parameters" element="s0:sayHelloResponse" />
|
||||
</message>
|
||||
|
||||
<portType name="Service1Soap">
|
||||
<operation name="sayHello">
|
||||
<input message="s0:sayHelloSoapIn" />
|
||||
|
||||
<output message="s0:sayHelloSoapOut" />
|
||||
</operation>
|
||||
</portType>
|
||||
|
||||
<binding name="Service1Soap" type="s0:Service1Soap">
|
||||
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
|
||||
style="document" />
|
||||
|
||||
<operation name="sayHello">
|
||||
<soap:operation soapAction="urn:HelloWorld#sayHello"
|
||||
style="document" />
|
||||
|
||||
<input>
|
||||
<soap:body use="literal" />
|
||||
</input>
|
||||
|
||||
<output>
|
||||
<soap:body use="literal" />
|
||||
</output>
|
||||
</operation>
|
||||
</binding>
|
||||
|
||||
<service name="Service1">
|
||||
<port name="Service1Soap" binding="s0:Service1Soap">
|
||||
<soap:address
|
||||
location="http://helloworld/helloworld.asmx" />
|
||||
</port>
|
||||
</service>
|
||||
</definitions>
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More;
|
||||
use File::Spec;
|
||||
use File::Basename;
|
||||
eval { require XML::Compile::WSDL11 }
|
||||
or plan skip_all => 'Cannot test without XML::Compile::WSDL11';
|
||||
|
||||
eval { require XML::LibXML }
|
||||
or plan skip_all => 'Cannot test without XML::LibXML';
|
||||
|
||||
plan skip_all => 'XML::Compile::WSDL11 is not functional yet';
|
||||
|
||||
plan tests => qw(no_plan);
|
||||
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
|
||||
my $libxml = XML::LibXML->new();
|
||||
my $xml = $libxml->parse_file("$path/../../../acceptance/wsdl/generator_test.wsdl");
|
||||
|
||||
my $wsdl = XML::Compile::WSDL11->new($xml);
|
||||
my $schemas = $wsdl->schemas;
|
||||
my $operation = $wsdl->operation('testHeader');
|
||||
|
||||
my $client = $operation->prepareClient();
|
||||
@@ -1,153 +0,0 @@
|
||||
use Test::More tests => 38;
|
||||
use File::Basename qw(dirname);
|
||||
use File::Spec;
|
||||
use File::Path;
|
||||
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
|
||||
use_ok qw(SOAP::WSDL::Generator::Visitor::Typelib);
|
||||
use_ok qw(SOAP::WSDL::Generator::Template::XSD);
|
||||
|
||||
use SOAP::WSDL::Expat::WSDLParser;
|
||||
|
||||
my $parser = SOAP::WSDL::Expat::WSDLParser->new();
|
||||
|
||||
my $definitions = $parser->parse_file(
|
||||
"$path/../../../acceptance/wsdl/generator_test.wsdl"
|
||||
#"$path/../../../acceptance/wsdl/elementAtomicComplexType.xml"
|
||||
);
|
||||
|
||||
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;
|
||||
|
||||
|
||||
$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();
|
||||
#$generator->generate_typelib();
|
||||
#$generator->generate_typemap();
|
||||
|
||||
if (eval { require Test::Warn; }) {
|
||||
Test::Warn::warning_like( sub { $generator->generate_interface() },
|
||||
qr{\A Multiple \s parts \s detected \s in \s message \s testMultiPartWarning}xms);
|
||||
}
|
||||
else {
|
||||
$generator->generate_interface();
|
||||
SKIP: { skip 'Cannot test warnings without Test::Warn', 1 };
|
||||
}
|
||||
|
||||
$generator->generate_server();
|
||||
|
||||
eval "use lib '$path/testlib'";
|
||||
use_ok qw( MyInterfaces::testService::testPort );
|
||||
|
||||
my $interface;
|
||||
|
||||
ok $interface = MyInterfaces::testService::testPort->new(), 'instanciate interface';
|
||||
$interface->set_no_dispatch(1);
|
||||
|
||||
my $message;
|
||||
|
||||
ok $message = $interface->testHeader( { Test1 => 'Test1', Test2 => 'Test2'}
|
||||
, { Test1 => 'Header1', Test2 => 'Header2'}), 'call soap method (no_dispatch)';
|
||||
|
||||
use_ok qw(SOAP::WSDL::Expat::MessageParser);
|
||||
use_ok qw(MyTypemaps::testService);
|
||||
|
||||
$parser = SOAP::WSDL::Expat::MessageParser->new({
|
||||
class_resolver => 'MyTypemaps::testService'
|
||||
});
|
||||
|
||||
ok $parser->parse_string($message), 'parse message with header';
|
||||
ok $parser->get_header()->get_Test1(), 'Header1';ok $message = $interface->testChoice( { Test1 => 'Test1' } ), 'call soap method (no_dispatch)';
|
||||
ok $parser->get_header()->get_Test2(), 'Header2';
|
||||
|
||||
ok $parser->get_data()->get_Test1(), 'Test1';
|
||||
ok $parser->get_data()->get_Test2(), 'Test2';
|
||||
|
||||
use_ok qw(SOAP::WSDL::Transport::Loopback);
|
||||
|
||||
$interface->set_no_dispatch(undef);
|
||||
$interface->set_transport(undef);
|
||||
$interface->set_proxy('http://127.0.0.1/Test');
|
||||
|
||||
for (1..2) {
|
||||
my ($body, $header) = $interface->testHeader( { Test1 => 'Test1', Test2 => 'Test2'} , { Test1 => 'Header1', Test2 => 'Header2'});
|
||||
is $header->get_Test1(), 'Header1', 'Header content';
|
||||
is $header->get_Test2(), 'Header2', 'Header content';
|
||||
}
|
||||
|
||||
|
||||
# complexType choice test
|
||||
ok $message = $interface->testChoice( { Test1 => 'Test1' } ), 'call soap method (no_dispatch)';
|
||||
ok $message = $interface->testChoice( { Test2 => 'Test2' } ), 'call soap method (no_dispatch)';
|
||||
|
||||
TODO: {
|
||||
local $TODO = 'implement content check';
|
||||
eval { $interface->testChoice( { Test1 => 'Test1', Test2 => 'Test2' } ) };
|
||||
ok $@, 'fail on both choice options';
|
||||
}
|
||||
#
|
||||
|
||||
ok eval { require MyTypes::testComplexTypeRestriction };
|
||||
my $complexRestriction = MyTypes::testComplexTypeRestriction->new();
|
||||
$complexRestriction->set_Test1('Test');
|
||||
is $complexRestriction->get_Test1(), 'Test';
|
||||
|
||||
$complexRestriction = MyTypes::testComplexTypeRestriction->new({
|
||||
Test1 => 'test1',
|
||||
Test2 => 'test2',
|
||||
});
|
||||
is $complexRestriction->get_Test1(), 'test1';
|
||||
is $complexRestriction->get_Test2(), 'test2';
|
||||
|
||||
ok eval { require MyTypes::testComplexTypeExtension };
|
||||
$complexExtension = MyTypes::testComplexTypeExtension->new({
|
||||
Test1 => 'test1',
|
||||
Test2 => 'test2',
|
||||
Test3 => 'test3',
|
||||
});
|
||||
is $complexExtension->get_Test1(), 'test1';
|
||||
is $complexExtension->get_Test2(), 'test2';
|
||||
is $complexExtension->get_Test3(), 'test3';
|
||||
|
||||
|
||||
ok eval { require MyTypes::testComplexTypeElementAtomicSimpleType; };
|
||||
my $ct_east = MyTypes::testComplexTypeElementAtomicSimpleType->new({
|
||||
testString => 'Just some test',
|
||||
testAtomicSimpleTypeElement => 42,
|
||||
testAtomicSimpleTypeElement2 => 23,
|
||||
});
|
||||
|
||||
is $ct_east->get_testAtomicSimpleTypeElement, 42;
|
||||
is $ct_east->get_testAtomicSimpleTypeElement->get_value(), 42;
|
||||
isa_ok($ct_east->get_testAtomicSimpleTypeElement,
|
||||
'MyTypes::testComplexTypeElementAtomicSimpleType::_testAtomicSimpleTypeElement');
|
||||
|
||||
|
||||
is $ct_east->get_testAtomicSimpleTypeElement2, 23;
|
||||
is $ct_east->get_testAtomicSimpleTypeElement2->get_value(), 23;
|
||||
isa_ok($ct_east->get_testAtomicSimpleTypeElement2,
|
||||
'MyTypes::testComplexTypeElementAtomicSimpleType::_testAtomicSimpleTypeElement2');
|
||||
|
||||
|
||||
rmtree "$path/testlib";
|
||||
@@ -1,24 +0,0 @@
|
||||
use Test::More tests => 3;
|
||||
use File::Basename qw(dirname);
|
||||
use File::Spec;
|
||||
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
|
||||
use_ok qw(SOAP::WSDL::Generator::Visitor::Typelib);
|
||||
use_ok qw(SOAP::WSDL::Generator::Template::XSD);
|
||||
|
||||
use SOAP::WSDL::Expat::WSDLParser;
|
||||
|
||||
my $parser = SOAP::WSDL::Expat::WSDLParser->new();
|
||||
my $definitions = $parser->parse_file(
|
||||
"$path/../../../acceptance/wsdl/generator_unsupported_test.wsdl"
|
||||
);
|
||||
|
||||
my $generator = SOAP::WSDL::Generator::Template::XSD->new({
|
||||
definitions => $definitions,
|
||||
});
|
||||
|
||||
{
|
||||
eval { $generator->generate_typelib() };
|
||||
}
|
||||
ok $@;
|
||||
Reference in New Issue
Block a user