import SOAP-WSDL 2.00_24 from CPAN
git-cpan-module: SOAP-WSDL git-cpan-version: 2.00_24 git-cpan-authorid: MKUTTER git-cpan-file: authors/id/M/MK/MKUTTER/SOAP-WSDL-2.00_24.tar.gz
This commit is contained in:
committed by
Michael G. Schwern
parent
b955c5ad79
commit
84b53d9261
@@ -18,23 +18,23 @@ sub BUILD {
|
||||
$self->set_RECURSION(1);
|
||||
$self->set_INCLUDE_PATH( exists $arg_ref->{INCLUDE_PATH}
|
||||
? $arg_ref->{INCLUDE_PATH}
|
||||
: do {
|
||||
# ignore uninitialized warnings - File::Spec warns about
|
||||
: do {
|
||||
# ignore uninitialized warnings - File::Spec warns about
|
||||
# uninitialized values, probably because we have no filename
|
||||
local $SIG{__WARN__} = sub {
|
||||
return if ($_[0]=~m{\buninitialized\b});
|
||||
CORE::warn @_;
|
||||
};
|
||||
|
||||
|
||||
# makeup path for the OS we're running on
|
||||
my ($volume, $dir, $file) = File::Spec->splitpath(
|
||||
my ($volume, $dir, $file) = File::Spec->splitpath(
|
||||
File::Spec->rel2abs( dirname __FILE__ )
|
||||
);
|
||||
$dir = File::Spec->catdir($dir, $file, 'XSD');
|
||||
# return path put together...
|
||||
my $path = File::Spec->catpath( $volume, $dir );
|
||||
|
||||
# Fixup path for windows - / works fine, \ does
|
||||
|
||||
# Fixup path for windows - / works fine, \ does
|
||||
# not...
|
||||
if ( eval { &Win32::BuildNumber } ) {
|
||||
$path =~s{\\}{/}g;
|
||||
@@ -54,16 +54,13 @@ sub generate {
|
||||
|
||||
sub generate_typelib {
|
||||
my ($self) = @_;
|
||||
|
||||
# $output_of{ ident $self } = "";
|
||||
|
||||
my @schema = @{ $self->get_definitions()->first_types()->get_schema() };
|
||||
for my $type (map { @{ $_->get_type() } , @{ $_->get_element() } } @schema[1..$#schema] ) {
|
||||
$type->_accept( $self );
|
||||
}
|
||||
|
||||
# return $output_of{ ident $self };
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
sub generate_interface {
|
||||
@@ -72,23 +69,23 @@ sub generate_interface {
|
||||
my $arg_ref = shift;
|
||||
my $tt = $self->get_tt();
|
||||
for my $service (@{ $self->get_definitions->get_service }) {
|
||||
for my $port (@{ $service->get_port() }) {
|
||||
for my $port (@{ $service->get_port() }) {
|
||||
# Skip ports without (known) address
|
||||
next if not $port->first_address;
|
||||
next if not $port->first_address->isa('SOAP::WSDL::SOAP::Address');
|
||||
|
||||
my $port_name = $port->get_name;
|
||||
$port_name =~s{ \A .+\. }{}xms;
|
||||
my $output = $arg_ref->{ output }
|
||||
? $arg_ref->{ output }
|
||||
: $self->_generate_filename(
|
||||
$self->get_interface_prefix(),
|
||||
$service->get_name(),
|
||||
my $output = $arg_ref->{ output }
|
||||
? $arg_ref->{ output }
|
||||
: $self->_generate_filename(
|
||||
$self->get_interface_prefix(),
|
||||
$service->get_name(),
|
||||
$port_name,
|
||||
);
|
||||
);
|
||||
print "Creating interface class $output\n";
|
||||
|
||||
$self->_process('Interface.tt',
|
||||
|
||||
$self->_process('Interface.tt',
|
||||
{
|
||||
service => $service,
|
||||
port => $port,
|
||||
@@ -101,7 +98,6 @@ sub generate_interface {
|
||||
|
||||
sub generate_typemap {
|
||||
my ($self, $arg_ref) = @_;
|
||||
|
||||
my $visitor = SOAP::WSDL::Generator::Visitor::Typemap->new({
|
||||
type_prefix => $self->get_type_prefix(),
|
||||
element_prefix => $self->get_element_prefix(),
|
||||
@@ -112,17 +108,16 @@ sub generate_typemap {
|
||||
'Fault/faultactor' => 'SOAP::WSDL::XSD::Typelib::Builtin::TOKEN',
|
||||
'Fault/faultstring' => 'SOAP::WSDL::XSD::Typelib::Builtin::string',
|
||||
'Fault/detail' => 'SOAP::WSDL::XSD::Typelib::Builtin::string',
|
||||
%{ $typemap_of{ident $self }},
|
||||
%{ $typemap_of{ident $self }},
|
||||
}
|
||||
});
|
||||
for my $service (@{ $self->get_definitions->get_service }) {
|
||||
$visitor->visit_Service( $service );
|
||||
my $output = $arg_ref->{ output }
|
||||
? $arg_ref->{ output }
|
||||
: $self->_generate_filename( $self->get_typemap_prefix(), $service->get_name() );
|
||||
|
||||
my $output = $arg_ref->{ output }
|
||||
? $arg_ref->{ output }
|
||||
: $self->_generate_filename( $self->get_typemap_prefix(), $service->get_name() );
|
||||
print "Creating typemap class $output\n";
|
||||
$self->_process('Typemap.tt',
|
||||
$self->_process('Typemap.tt',
|
||||
{
|
||||
service => $service,
|
||||
typemap => $visitor->get_typemap(),
|
||||
@@ -142,7 +137,7 @@ sub _generate_filename :PRIVATE {
|
||||
|
||||
sub visit_XSD_Element {
|
||||
my ($self, $element) = @_;
|
||||
my $output = defined $output_of{ ident $self }
|
||||
my $output = defined $output_of{ ident $self }
|
||||
? $output_of{ ident $self }
|
||||
: $self->_generate_filename( $self->get_element_prefix(), $element->get_name() );
|
||||
$self->_process('element.tt', { element => $element } , $output);
|
||||
@@ -150,7 +145,7 @@ sub visit_XSD_Element {
|
||||
|
||||
sub visit_XSD_SimpleType {
|
||||
my ($self, $type) = @_;
|
||||
my $output = defined $output_of{ ident $self }
|
||||
my $output = defined $output_of{ ident $self }
|
||||
? $output_of{ ident $self }
|
||||
: $self->_generate_filename( $self->get_type_prefix(), $type->get_name() );
|
||||
$self->_process('simpleType.tt', { simpleType => $type } , $output);
|
||||
@@ -158,7 +153,7 @@ sub visit_XSD_SimpleType {
|
||||
|
||||
sub visit_XSD_ComplexType {
|
||||
my ($self, $type) = @_;
|
||||
my $output = defined $output_of{ ident $self }
|
||||
my $output = defined $output_of{ ident $self }
|
||||
? $output_of{ ident $self }
|
||||
: $self->_generate_filename( $self->get_type_prefix(), $type->get_name() );
|
||||
$self->_process('complexType.tt', { complexType => $type } , $output);
|
||||
|
||||
@@ -2,11 +2,12 @@ package [% interface_prefix %]::[% service.get_name.replace('\.', '::') %]::[% p
|
||||
use strict;
|
||||
use warnings;
|
||||
use Class::Std::Storable;
|
||||
use Scalar::Util qw(blessed);
|
||||
use base qw(SOAP::WSDL::Client::Base);
|
||||
|
||||
# only load if it hasn't been loaded before
|
||||
require [% typemap_prefix %]::[% service.get_name.replace('\.', '::') %]
|
||||
if not [% typemap_prefix %]::[% service.get_name.replace('\.', '::') %]->can('get_class');
|
||||
if not [% typemap_prefix %]::[% service.get_name.replace('\.', '::') %]->can('get_class');
|
||||
|
||||
sub START {
|
||||
$_[0]->set_proxy('[% port.first_address.get_location %]') if not $_[2]->{proxy};
|
||||
@@ -18,6 +19,7 @@ sub START {
|
||||
FOREACH operation = binding.get_operation;
|
||||
%][% INCLUDE Interface/Operation.tt %]
|
||||
[%
|
||||
|
||||
END;
|
||||
%]
|
||||
|
||||
@@ -32,11 +34,22 @@ __END__
|
||||
=head1 NAME
|
||||
|
||||
|
||||
[% interface_prefix %]::[% service.get_name %]::[% port.get_name %] - SOAP Interface for the [% service.get_name %] Web Service
|
||||
[% interface_prefix %]::[% service.get_name.replace('\.', '::') %]::[% port.get_name.replace('\.', '::') %] - SOAP Interface for the [% service.get_name %] Web Service
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use [% interface_prefix %]::[% service.get_name.replace('\.', '::') %]::[% port.get_name.replace('\.', '::') %];
|
||||
my $interface = [% interface_prefix %]::[% service.get_name.replace('\.', '::') %]::[% port.get_name.replace('\.', '::') %]->new();
|
||||
|
||||
my $response;
|
||||
[% FOREACH operation = binding.get_operation;
|
||||
%] $response = $interface->[% operation.get_name %]();
|
||||
[% END %]
|
||||
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
SOAP Interface for the [% service.get_name %] web service
|
||||
SOAP Interface for the [% service.get_name %] web service
|
||||
located at [% port.first_address.get_location %].
|
||||
|
||||
=head1 SERVICE [% service.get_name %]
|
||||
@@ -64,7 +77,7 @@ All arguments are forwarded to L<SOAP::WSDL::Client|SOAP::WSDL::Client>.
|
||||
|
||||
[% FOREACH operation = binding.get_operation;
|
||||
%][% INCLUDE Interface/POD/Operation.tt %]
|
||||
[% END %]
|
||||
[% END %]
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
|
||||
@@ -11,54 +11,53 @@
|
||||
my $element_prefix = $stash->{ element_prefix };
|
||||
|
||||
my @body_part_from = split m{\s}, $item->get_parts;
|
||||
|
||||
my @parts;
|
||||
if (@body_part_from) {
|
||||
@parts = map {
|
||||
my $part = $_;
|
||||
(grep {
|
||||
my ($ns, $lname) = $def->expand( $_ );
|
||||
($lname eq $part->get_name)
|
||||
} @body_part_from
|
||||
)
|
||||
? do {
|
||||
my $name;
|
||||
($name = $part->get_element)
|
||||
? do {
|
||||
$name =~s{ ^[^:]+: }{}xms;
|
||||
$element_prefix . '::' . $name;
|
||||
}
|
||||
: ($name = $part->get_type)
|
||||
? do {
|
||||
$name =~s{ ^[^:]+: }{}xms;
|
||||
$type_prefix . '::' . $name;
|
||||
}
|
||||
: die "input must have either type or element"
|
||||
}
|
||||
: ()
|
||||
} @{ $part_from };
|
||||
}
|
||||
else {
|
||||
@parts = map {
|
||||
my $part = $_;
|
||||
my $name;
|
||||
($name = $part->get_element)
|
||||
? do {
|
||||
$name =~s{ ^[^:]+: }{}xms;
|
||||
"$element_prefix\::$name"
|
||||
}
|
||||
: ($name = $part->get_type)
|
||||
? do {
|
||||
$name =~s{ ^[^:]+: }{}xms;
|
||||
"$type_prefix\::$name"
|
||||
}
|
||||
: die "input must have either type or element";
|
||||
} @{ $part_from };
|
||||
|
||||
my @parts;
|
||||
if (@body_part_from) {
|
||||
@parts = map {
|
||||
my $part = $_;
|
||||
(grep {
|
||||
my ($ns, $lname) = $def->expand( $_ );
|
||||
($lname eq $part->get_name)
|
||||
} @body_part_from
|
||||
)
|
||||
? do {
|
||||
my $name;
|
||||
($name = $part->get_element)
|
||||
? do {
|
||||
$name =~s{ ^[^:]+: }{}xms;
|
||||
$element_prefix . '::' . $name;
|
||||
}
|
||||
: ($name = $part->get_type)
|
||||
? do {
|
||||
$name =~s{ ^[^:]+: }{}xms;
|
||||
$type_prefix . '::' . $name;
|
||||
}
|
||||
: die "input must have either type or element"
|
||||
}
|
||||
: ()
|
||||
} @{ $part_from };
|
||||
}
|
||||
else {
|
||||
@parts = map {
|
||||
my $part = $_;
|
||||
my $name;
|
||||
($name = $part->get_element)
|
||||
? do {
|
||||
$name =~s{ ^[^:]+: }{}xms;
|
||||
"$element_prefix\::$name"
|
||||
}
|
||||
: ($name = $part->get_type)
|
||||
? do {
|
||||
$name =~s{ ^[^:]+: }{}xms;
|
||||
"$type_prefix\::$name"
|
||||
}
|
||||
: die "input must have either type or element";
|
||||
} @{ $part_from };
|
||||
}
|
||||
$stash->{ parts } = \@parts;
|
||||
|
||||
[% END;
|
||||
%]
|
||||
|
||||
[% END %]
|
||||
'use' => '[% item.get_use %]',
|
||||
namespace => '[% item.get_namespace %]',
|
||||
encodingStyle => '[% item.get_encodingStyle %]',
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
[%
|
||||
RETURN IF NOT item;
|
||||
message_name = item.get_message;
|
||||
IF NOT message_name;
|
||||
THROW BAD_WSDL "missing <message> attribute in header for operation ${operation.get_name}";
|
||||
IF NOT message_name;
|
||||
THROW BAD_WSDL "missing <message> attribute in header for operation ${operation.get_name}";
|
||||
END;
|
||||
message = definitions.find_message( item.expand( message_name ) );
|
||||
PERL %]
|
||||
@@ -13,22 +13,22 @@
|
||||
my $element_prefix = $stash->{ element_prefix };
|
||||
my ($ns, $lname) = $def->expand( $item->get_part() );
|
||||
my ($part) = grep {
|
||||
$_->get_name eq $lname
|
||||
&& $_->get_targetNamespace eq $ns } @{ $message->get_part( ) };
|
||||
$_->get_name eq $lname
|
||||
&& $_->get_targetNamespace eq $ns } @{ $message->get_part( ) };
|
||||
my $part_class = do {
|
||||
my $name;
|
||||
($name = $part->get_element)
|
||||
? do {
|
||||
$name =~s{ ^[^:]+: }{}xms;
|
||||
$element_prefix . '::' . $name;
|
||||
}
|
||||
: ($name = $part->get_type)
|
||||
? do {
|
||||
$name =~s{ ^[^:]+: }{}xms;
|
||||
$type_prefix . '::' . $name;
|
||||
}
|
||||
: die "input must have either type or element"
|
||||
};
|
||||
my $name;
|
||||
($name = $part->get_element)
|
||||
? do {
|
||||
$name =~s{ ^[^:]+: }{}xms;
|
||||
$element_prefix . '::' . $name;
|
||||
}
|
||||
: ($name = $part->get_type)
|
||||
? do {
|
||||
$name =~s{ ^[^:]+: }{}xms;
|
||||
$type_prefix . '::' . $name;
|
||||
}
|
||||
: die "input must have either type or element"
|
||||
};
|
||||
$stash->{ part_class } = $part_class;
|
||||
[% END;
|
||||
%]
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
sub [% operation.get_name %] {
|
||||
my ($self, $body, $header) = @_;
|
||||
die "[% operation.get_name %] must be called as object method (\$self is <$self>)" if not blessed($self);
|
||||
return $self->SUPER::call({
|
||||
operation => '[% operation.get_name %]',
|
||||
operation => '[% operation.get_name %]',
|
||||
soap_action => '[% operation.first_operation.get_soapAction %]',
|
||||
style => '[% operation.get_style || binding.get_style %]',
|
||||
body => {
|
||||
body => {
|
||||
[% INCLUDE Interface/Body.tt( item = operation.first_input.first_body ); %]
|
||||
},
|
||||
header => {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
|
||||
[% INDENT; %][% element.get_name %] => [%-
|
||||
IF (element.get_ref);
|
||||
element = element.get_ref();
|
||||
END;
|
||||
IF (type_name = element.get_type);
|
||||
IF (element.get_ref);
|
||||
element = element.get_ref();
|
||||
END;
|
||||
IF (type_name = element.get_type);
|
||||
INCLUDE Interface/POD/Type.tt(type = definitions.first_types.find_type( element.expand(type_name) ) );
|
||||
ELSIF (type = element.first_complexType);
|
||||
INCLUDE Interface/POD/Type.tt(type = type );
|
||||
ELSIF (type = element.first_simpleType);
|
||||
INCLUDE Interface/POD/Type.tt(type = type );
|
||||
END;
|
||||
END;
|
||||
%]
|
||||
@@ -1,9 +1,9 @@
|
||||
[%
|
||||
message_name = port_op.first_input.get_message();
|
||||
# message_name;
|
||||
# message_name;
|
||||
|
||||
part_from = definitions.find_message( port_op.first_input.expand( message_name ) ).get_part;
|
||||
FOREACH part = part_from;
|
||||
INCLUDE Interface/POD/Part.tt(part = part);
|
||||
INCLUDE Interface/POD/Part.tt(part = part);
|
||||
END;
|
||||
%]
|
||||
@@ -1,7 +1,7 @@
|
||||
[% element = definitions.first_types.find_element( part.expand( part.get_element ) );
|
||||
#element.get_name();
|
||||
#element;
|
||||
#STOP;
|
||||
type = element.first_complexType || element.first_simpleType || definitions.first_types.find_type(
|
||||
element.expand( element.get_type ) );
|
||||
INCLUDE Interface/POD/Type.tt;%],
|
||||
#element.get_name();
|
||||
#element;
|
||||
#STOP;
|
||||
type = element.first_complexType || element.first_simpleType || definitions.first_types.find_type(
|
||||
element.expand( element.get_type ) );
|
||||
INCLUDE Interface/POD/Type.tt;%],
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[%- indent = ' ';
|
||||
IF type.isa('SOAP::WSDL::XSD::ComplexType');
|
||||
INCLUDE complexType/POD/structure.tt(complexType = type);
|
||||
INCLUDE complexType/POD/structure.tt(complexType = type);
|
||||
ELSE;
|
||||
INCLUDE simpleType/POD/structure.tt(simpleType = type);
|
||||
INCLUDE simpleType/POD/structure.tt(simpleType = type);
|
||||
END;
|
||||
indent.replace('\s{2}$',''); %]
|
||||
@@ -1,7 +1,7 @@
|
||||
Method synopsis is displayed with hash refs as parameters.
|
||||
Method synopsis is displayed with hash refs as parameters.
|
||||
|
||||
The commented class names in the method's parameters denote that objects
|
||||
The commented class names in the method's parameters denote that objects
|
||||
of the corresponding class can be passed instead of the marked hash ref.
|
||||
|
||||
You may pass any combination of objects, hash and list refs to these
|
||||
You may pass any combination of objects, hash and list refs to these
|
||||
methods, as long as you meet the structure.
|
||||
|
||||
@@ -4,7 +4,7 @@ use warnings;
|
||||
|
||||
our [% USE Dumper(varname = 'typemap_'); Dumper.dump( typemap ) %];
|
||||
|
||||
sub get_class {
|
||||
sub get_class {
|
||||
my $name = join '/', @{ $_[1] };
|
||||
exists $typemap_1->{ $name } or die "Cannot resolve $name via " . __PACKAGE__;
|
||||
return $typemap_1->{ $name };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[% type_name = node.expand( type );
|
||||
IF (type_name.0 == 'http://www.w3.org/2001/XMLSchema'); -%]
|
||||
[% type_name = node.expand( type );
|
||||
IF (type_name.0 == 'http://www.w3.org/2001/XMLSchema'); -%]
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::[% type_name.1 %]
|
||||
[% ELSE -%]
|
||||
[% type_prefix %]::[% type_name.1 %]
|
||||
[% END -%]
|
||||
[% ELSE -%]
|
||||
[% type_prefix %]::[% type_name.1 %]
|
||||
[% END -%]
|
||||
@@ -2,8 +2,8 @@ package [% type_prefix %]::[% complexType.get_name %];
|
||||
use strict;
|
||||
use warnings;
|
||||
[% INCLUDE complexType/contentModel.tt %]
|
||||
[%#
|
||||
# Don't include any perl source here - there may be sub-packages...
|
||||
[%#
|
||||
# Don't include any perl source here - there may be sub-packages...
|
||||
#-%]
|
||||
|
||||
1;
|
||||
@@ -21,7 +21,7 @@ Perl data type class for the XML Schema defined complextype
|
||||
|
||||
=head2 PROPERTIES
|
||||
|
||||
The following properties may be accessed using get_PROPERTY / set_PROPERTY
|
||||
The following properties may be accessed using get_PROPERTY / set_PROPERTY
|
||||
methods:
|
||||
|
||||
[% FOREACH element = complexType.get_element -%]
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
[% IF (complexType.get_variety == 'restriction');
|
||||
INCLUDE complexType/POD/restriction.tt(complexType = complexType);
|
||||
INCLUDE complexType/POD/restriction.tt(complexType = complexType);
|
||||
ELSIF (complexType.get_variety == 'sequence');
|
||||
THROW NOT_IMPLEMENTED, "${ complexType.get_name } - complexType complexContent extension not implemented yet";
|
||||
THROW NOT_IMPLEMENTED, "${ complexType.get_name } - complexType complexContent extension not implemented yet";
|
||||
ELSE;
|
||||
THROW UNKNOWN, "unknown variety ${ complexType.get_variety }";
|
||||
THROW UNKNOWN, "unknown variety ${ complexType.get_variety }";
|
||||
END;
|
||||
|
||||
%]
|
||||
@@ -1,13 +1,13 @@
|
||||
[% IF (complexType.get_variety == 'all');
|
||||
INCLUDE complexType/POD/all.tt(complexType = complexType);
|
||||
INCLUDE complexType/POD/all.tt(complexType = complexType);
|
||||
ELSIF (complexType.get_variety == 'sequence');
|
||||
INCLUDE complexType/POD/all.tt(complexType = complexType);
|
||||
INCLUDE complexType/POD/all.tt(complexType = complexType);
|
||||
ELSIF (complexType.get_variety == 'group');
|
||||
THROW NOT_IMPLEMENTED, "${ element.get_name } - complexType group not implemented yet";
|
||||
THROW NOT_IMPLEMENTED, "${ element.get_name } - complexType group not implemented yet";
|
||||
ELSIF (complexType.get_variety == 'choice');
|
||||
INCLUDE complexType/POD/choice.tt(complexType = complexType);
|
||||
INCLUDE complexType/POD/choice.tt(complexType = complexType);
|
||||
ELSIF (complexType.get_contentModel == 'simpleContent');
|
||||
THROW NOT_IMPLEMENTED, "${ element.get_name } - complexType simpleContent not implemented yet";
|
||||
THROW NOT_IMPLEMENTED, "${ element.get_name } - complexType simpleContent not implemented yet";
|
||||
ELSIF (complexType.get_contentModel == 'complexContent');
|
||||
INCLUDE complexType/POD/complexContent.tt(complexType = complexType);
|
||||
END %]
|
||||
INCLUDE complexType/POD/complexContent.tt(complexType = complexType);
|
||||
END %],
|
||||
@@ -2,8 +2,8 @@ use Class::Std::Storable;
|
||||
use base qw(SOAP::WSDL::XSD::Typelib::ComplexType);
|
||||
|
||||
{ # BLOCK to scope variables
|
||||
[%
|
||||
atomic_types = [];
|
||||
[%
|
||||
atomic_types = {};
|
||||
|
||||
FOREACH element = complexType.get_element %]
|
||||
my %[% element.get_name %]_of :ATTR(:get<[% element.get_name %]>);
|
||||
@@ -14,30 +14,30 @@ __PACKAGE__->_factory(
|
||||
[% element.get_name -%]
|
||||
[% END %]
|
||||
) ],
|
||||
{
|
||||
{
|
||||
[% FOREACH element = complexType.get_element -%]
|
||||
[% element.get_name %] => \%[% element.get_name %]_of,
|
||||
[% END -%]
|
||||
[% element.get_name %] => \%[% element.get_name %]_of,
|
||||
[% END -%]
|
||||
},
|
||||
{
|
||||
[% FOREACH element = complexType.get_element;
|
||||
IF (type = element.get_type);
|
||||
element_type = complexType.expand( type );
|
||||
IF (element_type.0 == 'http://www.w3.org/2001/XMLSchema'); -%]
|
||||
IF (type = element.get_type);
|
||||
element_type = complexType.expand( type );
|
||||
IF (element_type.0 == 'http://www.w3.org/2001/XMLSchema'); -%]
|
||||
[% element.get_name %] => 'SOAP::WSDL::XSD::Typelib::Builtin::[% element_type.1 %]',
|
||||
[% ELSE -%]
|
||||
[% ELSE -%]
|
||||
[% element.get_name %] => '[% type_prefix %]::[% element_type.1 %]',
|
||||
[% END;
|
||||
ELSE;
|
||||
IF (element.first_simpleType);
|
||||
atomic_types.push( element.first_simpleType );
|
||||
ELSIF (element.first_simpleType);
|
||||
atomic_types.push( element.first_simpleType );
|
||||
ELSE;
|
||||
THROW NOT_IMPLEMENTED , "atomic types in complexType elements not supported yet";
|
||||
END; %]
|
||||
[% element.get_name %] => '[% type_prefix %]::[% complexType.get_name %]::_[% element.get_name %]',
|
||||
[% END;
|
||||
[% END;
|
||||
ELSE;
|
||||
IF (element.first_simpleType);
|
||||
atomic_types.${ element.get_name } = element.first_simpleType;
|
||||
ELSIF (element.first_complexType);
|
||||
atomic_types.${ element.get_name } = element.first_complexType;
|
||||
ELSE;
|
||||
THROW NOT_IMPLEMENTED , "Neither simple nor complex atomic type - don't know what to do with it";
|
||||
END; %]
|
||||
[% element.get_name %] => '[% type_prefix %]::[% complexType.get_name %]::_[% element.get_name %]',
|
||||
[% END;
|
||||
END -%]
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
|
||||
[% FOREACH type = atomic_types; %]
|
||||
[% FOREACH type IN atomic_types; %]
|
||||
|
||||
package [% type_prefix %]::[% complexType.get_name %]::_[% element.get_name %];
|
||||
package [% type_prefix %]::[% complexType.get_name %]::_[% type.key %];
|
||||
use strict;
|
||||
use warnings;
|
||||
{
|
||||
[% IF ( type.isa('SOAP::WSDL::XSD::ComplexType') );
|
||||
INCLUDE complexType/contentModel.tt(complexType = type );
|
||||
ELSIF ( type.isa('SOAP::WSDL::XSD::SimpleType') );
|
||||
INCLUDE simpleType/contentModel.tt(simpleType = type );
|
||||
ELSE;
|
||||
PERL; %] die $stash->{ type }->_DUMP [% END;
|
||||
THROW UNKNOWN, "neither complex nor simple type - don't know what to do";
|
||||
[% IF ( type.value.isa('SOAP::WSDL::XSD::ComplexType') );
|
||||
INCLUDE complexType/contentModel.tt(complexType = type.value );
|
||||
ELSIF ( type.value.isa('SOAP::WSDL::XSD::SimpleType') );
|
||||
INCLUDE simpleType/contentModel.tt(simpleType = type.value );
|
||||
ELSE;
|
||||
PERL; %] die $stash->{ type } [% END;
|
||||
THROW UNKNOWN, "neither complex nor simple type - don't know what to do";
|
||||
END
|
||||
%]
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
[% IF (complexType.get_variety == 'restriction');
|
||||
INCLUDE complexType/restriction.tt(complexType = complexType);
|
||||
INCLUDE complexType/restriction.tt(complexType = complexType);
|
||||
ELSIF (complexType.get_variety == 'sequence');
|
||||
INCLUDE complexType/extension.tt(complexType = complexType);
|
||||
INCLUDE complexType/extension.tt(complexType = complexType);
|
||||
ELSE;
|
||||
THROW UNKNOWN, "unknown variety ${ complexType.get_variety }";
|
||||
THROW UNKNOWN, "unknown variety ${ complexType.get_variety }";
|
||||
END;
|
||||
%]
|
||||
@@ -1,7 +1,7 @@
|
||||
[% IF (complexType.get_contentModel == 'simpleContent');
|
||||
THROW NOT_IMPLEMENTED, "${ element.get_name } - complexType simpleContent not implemented yet";
|
||||
THROW NOT_IMPLEMENTED, "${ element.get_name } - complexType simpleContent not implemented yet";
|
||||
ELSIF (complexType.get_contentModel == 'complexContent');
|
||||
INCLUDE complexType/complexContent.tt(complexType = complexType);
|
||||
INCLUDE complexType/complexContent.tt(complexType = complexType);
|
||||
ELSE;
|
||||
INCLUDE complexType/variety.tt(complexType = complexType);
|
||||
INCLUDE complexType/variety.tt(complexType = complexType);
|
||||
END %]
|
||||
|
||||
@@ -9,14 +9,14 @@ element_from = complexType.get_element;
|
||||
# Sanity check: All original elements must be noted first
|
||||
#
|
||||
FOREACH element = base_type.get_element;
|
||||
IF element_from.${ loop.index }.get_name != element.get_name;
|
||||
THROW WSDL "${element.get_name} not found at position ${ loop.index } in extension type ${ complexType.get_name }";
|
||||
END;
|
||||
IF element_from.${ loop.index }.get_name != element.get_name;
|
||||
THROW WSDL "${element.get_name} not found at position ${ loop.index } in extension type ${ complexType.get_name }";
|
||||
END;
|
||||
END;
|
||||
|
||||
|
||||
-%]
|
||||
use base qw([% type_prefix %]::[% base_name.1.replace('\.', '::') %]);
|
||||
use base qw([% type_prefix %]::[% base_name.1.replace('\.', '::') %]);
|
||||
[%
|
||||
|
||||
INCLUDE complexType/variety.tt(complexType = complexType);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
[% IF (base=complexType.get_base);
|
||||
base_name=complexType.expand(base);
|
||||
base_name=complexType.expand(base);
|
||||
-%]
|
||||
use base qw([% type_prefix %]::[% base_name.1.replace('\.', '::') %]);
|
||||
[%
|
||||
use base qw([% type_prefix %]::[% base_name.1.replace('\.', '::') %]);
|
||||
[%
|
||||
ELSE;
|
||||
THROW NOT_IMPLEMENTED, "restriction without base not supported";
|
||||
THROW NOT_IMPLEMENTED, "restriction without base not supported";
|
||||
END %]
|
||||
@@ -1,15 +1,15 @@
|
||||
[%
|
||||
IF (complexType.get_variety == 'all');
|
||||
INCLUDE complexType/all.tt(complexType = complexType);
|
||||
INCLUDE complexType/all.tt(complexType = complexType);
|
||||
ELSIF (complexType.get_variety == 'sequence');
|
||||
INCLUDE complexType/all.tt(complexType = complexType);
|
||||
INCLUDE complexType/all.tt(complexType = complexType);
|
||||
ELSIF (complexType.get_variety == 'group');
|
||||
THROW NOT_IMPLEMENTED, "${ element.get_name } - complexType group not implemented yet";
|
||||
THROW NOT_IMPLEMENTED, "${ element.get_name } - complexType group not implemented yet";
|
||||
ELSIF (complexType.get_variety == 'choice');
|
||||
INCLUDE complexType/all.tt(complexType = complexType);
|
||||
INCLUDE complexType/all.tt(complexType = complexType);
|
||||
ELSIF (complexType.get_variety);
|
||||
THROW NOT_IMPLEMENTED, "Unknown variety ${ complexType.get_variety } in ${ complexType.get_name } (${ element.get_name })";
|
||||
THROW NOT_IMPLEMENTED, "Unknown variety ${ complexType.get_variety } in ${ complexType.get_name } (${ element.get_name })";
|
||||
ELSE;
|
||||
# There's no variety - might be empty complexType
|
||||
# There's no variety - might be empty complexType
|
||||
END;
|
||||
%]
|
||||
@@ -14,26 +14,26 @@ __PACKAGE__->__set_ref([% IF element.get_ref; %]'[% element.get_ref %]'[% END %]
|
||||
|
||||
[%- IF (type = element.get_type); -%]
|
||||
use base qw(
|
||||
SOAP::WSDL::XSD::Typelib::Element
|
||||
[% INCLUDE _type_class.tt( type = type, node = element ) %]
|
||||
SOAP::WSDL::XSD::Typelib::Element
|
||||
[% INCLUDE _type_class.tt( type = type, node = element ) %]
|
||||
);
|
||||
[%- ELSIF (ref = element.get_ref); -%]
|
||||
# element ref="[% ref %]"
|
||||
use base qw(
|
||||
[% element_prefix %]::[% ref.split(':').1 %]
|
||||
[% element_prefix %]::[% ref.split(':').1 %]
|
||||
);
|
||||
[%- ELSIF (simpleType = element.first_simpleType) %]
|
||||
# atomic simpleType: <element><simpleType
|
||||
# atomic simpleType: <element><simpleType
|
||||
use base qw(
|
||||
SOAP::WSDL::XSD::Typelib::Element
|
||||
SOAP::WSDL::XSD::Typelib::Element
|
||||
);
|
||||
[% INCLUDE simpleType/contentModel.tt %]
|
||||
[% ELSIF (complexType = element.first_complexType) %]
|
||||
use base qw(
|
||||
SOAP::WSDL::XSD::Typelib::Element
|
||||
SOAP::WSDL::XSD::Typelib::ComplexType
|
||||
SOAP::WSDL::XSD::Typelib::Element
|
||||
SOAP::WSDL::XSD::Typelib::ComplexType
|
||||
);
|
||||
[% INCLUDE complexType/contentModel.tt;
|
||||
[% INCLUDE complexType/contentModel.tt;
|
||||
END %]
|
||||
|
||||
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
[%- IF (name = element.get_type);
|
||||
type_name = element.expand(name);
|
||||
IF (type_name.0 == 'http://www.w3.org/2001/XMLSchema'); -%]
|
||||
[%- IF (name = element.get_type);
|
||||
type_name = element.expand(name);
|
||||
IF (type_name.0 == 'http://www.w3.org/2001/XMLSchema'); -%]
|
||||
$some_value, # [% type_name.1 %]
|
||||
[%-
|
||||
RETURN;
|
||||
ELSIF (type = definitions.first_types.find_type( type_name ));
|
||||
IF (type.isa('SOAP::WSDL::XSD::ComplexType') );
|
||||
INCLUDE complexType/POD/structure.tt(complexType = type);
|
||||
RETURN;
|
||||
ELSE;
|
||||
INCLUDE simpleType/POD/structure.tt(simpleType = type);
|
||||
END;
|
||||
RETURN;
|
||||
END;
|
||||
THROW NOT_FOUND, "no type found for {${type_name.0}}${type_name.1}";
|
||||
[%-
|
||||
RETURN;
|
||||
ELSIF (type = definitions.first_types.find_type( type_name ));
|
||||
IF (type.isa('SOAP::WSDL::XSD::ComplexType') );
|
||||
INCLUDE complexType/POD/structure.tt(complexType = type);
|
||||
RETURN;
|
||||
ELSE;
|
||||
INCLUDE simpleType/POD/structure.tt(simpleType = type);
|
||||
END;
|
||||
RETURN;
|
||||
END;
|
||||
THROW NOT_FOUND, "no type found for {${type_name.0}}${type_name.1}";
|
||||
ELSIF (ref = element.get_ref);
|
||||
ref_element = definitions.first_types.find_element( element.expand( ref ) );
|
||||
INCLUDE element/POD/structure.tt(element = ref_element);
|
||||
RETURN;
|
||||
ref_element = definitions.first_types.find_element( element.expand( ref ) );
|
||||
INCLUDE element/POD/structure.tt(element = ref_element);
|
||||
RETURN;
|
||||
ELSIF (type = element.first_simpleType);
|
||||
INCLUDE simpleType/POD/structure.tt(simpleType = type);
|
||||
RETURN;
|
||||
INCLUDE simpleType/POD/structure.tt(simpleType = type);
|
||||
RETURN;
|
||||
ELSIF (type = element.first_complexType);
|
||||
INCLUDE complexType/POD/structure.tt(complexType = type);
|
||||
INCLUDE complexType/POD/structure.tt(complexType = type);
|
||||
ELSE;
|
||||
THROW NOT_FOUND, "no type found for ${element.get_name}";
|
||||
THROW NOT_FOUND, "no type found for ${element.get_name}";
|
||||
%]
|
||||
NO TYPE FOUND FOR ELEMENT [% element.get_name %]
|
||||
NO TYPE FOUND FOR ELEMENT [% element.get_name %]
|
||||
[% END -%]
|
||||
@@ -5,8 +5,8 @@ use warnings;
|
||||
sub get_xmlns { '[% simpleType.get_targetNamespace %]'};
|
||||
|
||||
[% INCLUDE simpleType/contentModel.tt %]
|
||||
[%#
|
||||
# Don't include any perl source here - there may be sub-packages...
|
||||
[%#
|
||||
# Don't include any perl source here - there may be sub-packages...
|
||||
#-%]
|
||||
|
||||
1;
|
||||
@@ -20,12 +20,12 @@ sub get_xmlns { '[% simpleType.get_targetNamespace %]'};
|
||||
Perl data type class for the XML Schema defined simpleType
|
||||
[% simpleType.get_name %] from the namespace [% simpleType.get_targetNamespace %].
|
||||
|
||||
[% IF (simpleType.get_variety == 'list');
|
||||
INCLUDE simpleType/POD/list.tt;
|
||||
ELSIF (simpleType.get_variety == 'restriction');
|
||||
INCLUDE simpleType/POD/restriction.tt;
|
||||
ELSE;
|
||||
THROW NOT_IMPLEMENTED "simpleType union not implemented yet in $simpleType.get_name";
|
||||
[% IF (simpleType.get_variety == 'list');
|
||||
INCLUDE simpleType/POD/list.tt;
|
||||
ELSIF (simpleType.get_variety == 'restriction');
|
||||
INCLUDE simpleType/POD/restriction.tt;
|
||||
ELSE;
|
||||
THROW NOT_IMPLEMENTED "simpleType union not implemented yet in $simpleType.get_name";
|
||||
END %]
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
This clase is derived from
|
||||
[%-
|
||||
[%-
|
||||
IF (name = simpleType.get_itemType);
|
||||
type_name = simpleType.expand( name );
|
||||
IF (type_name.0 == 'http://www.w3.org/2001/XMLSchema'); -%]
|
||||
type_name = simpleType.expand( name );
|
||||
IF (type_name.0 == 'http://www.w3.org/2001/XMLSchema'); -%]
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::[% type_name.1 %]
|
||||
[% ELSE -%]
|
||||
[% type_prefix %]::[% type_name.1 %]
|
||||
[% END;
|
||||
[% ELSE -%]
|
||||
[% type_prefix %]::[% type_name.1 %]
|
||||
[% END;
|
||||
ELSE;
|
||||
# THROW NOT_IMPLEMENTED "atomic simpleType list not implemented yet in $simpleType.get_name";
|
||||
%] a atomic base type. Unfortunately there's no documenatation generation for atomic base types yet. [%
|
||||
# THROW NOT_IMPLEMENTED "atomic simpleType list not implemented yet in $simpleType.get_name";
|
||||
%] a atomic base type. Unfortunately there's no documenatation generation for atomic base types yet. [%
|
||||
END -%].
|
||||
|
||||
You may pass the following structure to new():
|
||||
|
||||
[ $value_1, .. $value_n ]
|
||||
|
||||
All elements of the list must be of the class' base type (or
|
||||
valid arguments to it's constructor).
|
||||
All elements of the list must be of the class' base type (or valid arguments
|
||||
to it's constructor).
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
This clase is derived from
|
||||
[%-
|
||||
This clase is derived from [%-
|
||||
IF (name = simpleType.get_base);
|
||||
type_name = simpleType.expand( name );
|
||||
IF (type_name.0 == 'http://www.w3.org/2001/XMLSchema'); -%]
|
||||
type_name = simpleType.expand( name );
|
||||
IF (type_name.0 == 'http://www.w3.org/2001/XMLSchema'); -%]
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::[% type_name.1 %]
|
||||
[% ELSE -%]
|
||||
[% type_prefix %]::[% type_name.1 %]
|
||||
[% END;
|
||||
[% ELSE -%]
|
||||
[% type_prefix %]::[% type_name.1 %]
|
||||
[% END;
|
||||
ELSE;
|
||||
# THROW NOT_IMPLEMENTED "atomic simpleType restriction not implemented yet in $simpleType.get_name";
|
||||
%] a atomic base type. Unfortunately there's no documenatation generation for atomic base types yet. [%
|
||||
# THROW NOT_IMPLEMENTED "atomic simpleType restriction not implemented yet in $simpleType.get_name";
|
||||
%] a atomic base type. Unfortunately there's no documenatation generation for atomic base types yet. [%
|
||||
END -%]
|
||||
. SOAP::WSDL's schema implementation does not validate data, so you can use it exactly
|
||||
. SOAP::WSDL's schema implementation does not validate data, so you can use it exactly
|
||||
like it's base type.
|
||||
|
||||
# Description of restrictions not implemented yet.
|
||||
@@ -1,7 +1,7 @@
|
||||
[% IF (simpleType.get_variety == 'list');
|
||||
INCLUDE simpleType/list.tt(simpleType = simpleType);
|
||||
[% IF (simpleType.get_variety == 'list');
|
||||
INCLUDE simpleType/list.tt(simpleType = simpleType);
|
||||
ELSIF (simpleType.get_variety == 'restriction');
|
||||
INCLUDE simpleType/restriction.tt(type = simpleType);
|
||||
ELSE;
|
||||
THROW NOT_IMPLEMENTED "${ element.get_name } - ${ simpleType.get_variety } not supported yet";
|
||||
INCLUDE simpleType/restriction.tt(type = simpleType);
|
||||
ELSE;
|
||||
THROW NOT_IMPLEMENTED "${ element.get_name } - ${ simpleType.get_variety } not supported yet";
|
||||
END %]
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
# list derivation
|
||||
use base qw(
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::list
|
||||
[%
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::list
|
||||
[%
|
||||
IF (name = simpleType.get_itemType);
|
||||
type_name = simpleType.expand( name );
|
||||
IF (type_name.0 == 'http://www.w3.org/2001/XMLSchema'); -%]
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::[% type_name.1 %]
|
||||
type_name = simpleType.expand( name );
|
||||
IF (type_name.0 == 'http://www.w3.org/2001/XMLSchema'); -%]
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::[% type_name.1 %]
|
||||
);
|
||||
[% ELSE -%]
|
||||
[% type_prefix %]::[% type_name.1 %]
|
||||
[% ELSE -%]
|
||||
[% type_prefix %]::[% type_name.1 %]
|
||||
);
|
||||
[% END;
|
||||
[% END;
|
||||
ELSIF (type = simpleType.first_simpleType); %]
|
||||
);
|
||||
|
||||
[% INCLUDE simpleType/atomicType.tt(type = type);
|
||||
[% INCLUDE simpleType/atomicType.tt(type = type);
|
||||
ELSE; PERL %]die $stash->{simpleType}._DUMP [% END;
|
||||
THROW UNKNOWN , "No list itemTape and no atomic simpleType - don't know what to do";
|
||||
THROW UNKNOWN , "No list itemTape and no atomic simpleType - don't know what to do";
|
||||
END %]
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# derivation by restriction
|
||||
[% IF (base = simpleType.get_base) -%]
|
||||
use base qw(
|
||||
[% INCLUDE _type_class.tt(type = base, node=simpleType) %]);
|
||||
[% INCLUDE _type_class.tt(type = base, node=simpleType) %]);
|
||||
[% ELSIF (type = simpleType.first_simpleType() );
|
||||
INCLUDE simpleType/atomicType.tt(type = type);
|
||||
INCLUDE simpleType/atomicType.tt(type = type);
|
||||
ELSE;
|
||||
THROW "neither base nor atomic type - don't know what to do" %]
|
||||
THROW "neither base nor atomic type - don't know what to do" %]
|
||||
[% END %]
|
||||
Reference in New Issue
Block a user