import SOAP-WSDL 2.00_18 from CPAN
git-cpan-module: SOAP-WSDL git-cpan-version: 2.00_18 git-cpan-authorid: MKUTTER git-cpan-file: authors/id/M/MK/MKUTTER/SOAP-WSDL-2.00_18.tar.gz
This commit is contained in:
committed by
Michael G. Schwern
parent
008d06b72a
commit
21efa286af
8
Build.PL
8
Build.PL
@@ -4,13 +4,13 @@ $build = Module::Build->new(
|
||||
create_makefile_pl => 'passthrough',
|
||||
dist_abstract => 'SOAP with WSDL support',
|
||||
dist_name => 'SOAP-WSDL',
|
||||
dist_version => '2.00_17',
|
||||
dist_version => '2.00_18',
|
||||
module_name => 'SOAP::WSDL',
|
||||
license => 'artistic',
|
||||
requires => {
|
||||
'Class::Std' => q/v0.0.8/,
|
||||
'Class::Std::Storable' => 0,
|
||||
'Data::Dumper' => 0,
|
||||
'Data::Dumper' => 0,
|
||||
'Date::Parse' => 0,
|
||||
'Date::Format' => 0,
|
||||
'File::Basename' => 0,
|
||||
@@ -25,7 +25,7 @@ $build = Module::Build->new(
|
||||
buildrequires => {
|
||||
'Class::Std' => q/v0.0.8/,
|
||||
'Class::Std::Storable' => 0,
|
||||
'Cwd' => 0,
|
||||
'Cwd' => 0,
|
||||
'Date::Parse' => 0,
|
||||
'Date::Format' => 0,
|
||||
'Getopt::Long' => 0,
|
||||
@@ -33,7 +33,7 @@ $build = Module::Build->new(
|
||||
'LWP::UserAgent' => 0,
|
||||
'File::Basename' => 0,
|
||||
'File::Path' => 0,
|
||||
'File::Spec' => 0,
|
||||
'File::Spec' => 0,
|
||||
'Storable' => 0,
|
||||
'Test::More' => 0,
|
||||
'Template' => 0,
|
||||
|
||||
25
CHANGES
25
CHANGES
@@ -1,4 +1,4 @@
|
||||
Release notes for SOAP::WSDL 2.00_17
|
||||
Release notes for SOAP::WSDL 2.00_18
|
||||
-------
|
||||
|
||||
I'm proud to present a new pre-release version of SOAP::WSDL.
|
||||
@@ -20,7 +20,7 @@ Features:
|
||||
the module's internals
|
||||
* Thorough test suite
|
||||
o SOAP::WSDL is heavily regression tested, with a test coverage of
|
||||
over 90%.
|
||||
over 95%.
|
||||
* SOAP::Lite like look and feel
|
||||
o Where possible, SOAP::WSDL mimics SOAP::Lite's API to allow easy migrations
|
||||
* XML schema based class library for creating data objects
|
||||
@@ -33,6 +33,27 @@ Features:
|
||||
|
||||
The following changes have been made:
|
||||
|
||||
2.00_18
|
||||
----
|
||||
The following features were added (the numbers in square brackets are the
|
||||
tracker IDs from https://sourceforge.net/tracker/?group_id=111978&atid=660924):
|
||||
|
||||
* [ 1790983 ] Create generator Plugin API
|
||||
Generator factory is SOAP::WSDL::Factory::Generator
|
||||
|
||||
The following bugs have been fixed (the numbers in square brackets are the
|
||||
tracker IDs from https://sourceforge.net/tracker/?group_id=111978&atid=660921):
|
||||
|
||||
* [ 1805252 ] t/SOAP/WSDL/XSD/Typelib/Builtin/004_time.t fails
|
||||
The default timezone conversion has been fixed.
|
||||
|
||||
The following uncategorized improvements have been made:
|
||||
|
||||
* Documentation improvements
|
||||
* Test updates
|
||||
* readable() has been converted into a no-op, as it already had no effect
|
||||
any more
|
||||
|
||||
2.00_17
|
||||
----
|
||||
The following features were added (the numbers in square brackets are the
|
||||
|
||||
4
MANIFEST
4
MANIFEST
@@ -48,6 +48,7 @@ lib/SOAP/WSDL/Expat/MessageParser.pm
|
||||
lib/SOAP/WSDL/Expat/MessageStreamParser.pm
|
||||
lib/SOAP/WSDL/Expat/WSDLParser.pm
|
||||
lib/SOAP/WSDL/Factory/Deserializer.pm
|
||||
lib/SOAP/WSDL/Factory/Generator.pm
|
||||
lib/SOAP/WSDL/Factory/Serializer.pm
|
||||
lib/SOAP/WSDL/Factory/Transport.pm
|
||||
lib/SOAP/WSDL/Generator/Template.pm
|
||||
@@ -90,12 +91,12 @@ lib/SOAP/WSDL/Generator/Visitor/Typelib.pm
|
||||
lib/SOAP/WSDL/Generator/Visitor/Typemap.pm
|
||||
lib/SOAP/WSDL/Manual.pod
|
||||
lib/SOAP/WSDL/Manual/Glossary.pod
|
||||
lib/SOAP/WSDL/Manual/Parser.pod
|
||||
lib/SOAP/WSDL/Manual/WS_I.pod
|
||||
lib/SOAP/WSDL/Manual/XSD.pod
|
||||
lib/SOAP/WSDL/Message.pm
|
||||
lib/SOAP/WSDL/Operation.pm
|
||||
lib/SOAP/WSDL/OpMessage.pm
|
||||
lib/SOAP/WSDL/Parser.pod
|
||||
lib/SOAP/WSDL/Part.pm
|
||||
lib/SOAP/WSDL/Port.pm
|
||||
lib/SOAP/WSDL/PortType.pm
|
||||
@@ -262,6 +263,7 @@ t/SOAP/WSDL/Factory/Transport.t
|
||||
t/SOAP/WSDL/Generator/Template.t
|
||||
t/SOAP/WSDL/Generator/Visitor.t
|
||||
t/SOAP/WSDL/Generator/Visitor/Typemap.t
|
||||
t/SOAP/WSDL/Generator/XCS.t
|
||||
t/SOAP/WSDL/Generator/XSD.t
|
||||
t/SOAP/WSDL/Generator/XSD_unsupported.t
|
||||
t/SOAP/WSDL/Transport/01_Test.t
|
||||
|
||||
6
META.yml
6
META.yml
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: SOAP-WSDL
|
||||
version: 2.00_17
|
||||
version: 2.00_18
|
||||
author: []
|
||||
abstract: SOAP with WSDL support
|
||||
license: artistic
|
||||
@@ -57,6 +57,9 @@ provides:
|
||||
file: lib/SOAP/WSDL/Expat/MessageStreamParser.pm
|
||||
SOAP::WSDL::Factory::Deserializer:
|
||||
file: lib/SOAP/WSDL/Factory/Deserializer.pm
|
||||
SOAP::WSDL::Factory::Generator:
|
||||
file: lib/SOAP/WSDL/Factory/Generator.pm
|
||||
version: 2.00_18
|
||||
SOAP::WSDL::Factory::Serializer:
|
||||
file: lib/SOAP/WSDL/Factory/Serializer.pm
|
||||
version: 2.00_17
|
||||
@@ -219,6 +222,7 @@ provides:
|
||||
file: lib/SOAP/WSDL/XSD/Typelib/Builtin/string.pm
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::time:
|
||||
file: lib/SOAP/WSDL/XSD/Typelib/Builtin/time.pm
|
||||
version: 2.00_18
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::token:
|
||||
file: lib/SOAP/WSDL/XSD/Typelib/Builtin/token.pm
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::unsignedByte:
|
||||
|
||||
@@ -5,7 +5,7 @@ use Pod::Usage;
|
||||
use Getopt::Long;
|
||||
use LWP::UserAgent;
|
||||
use SOAP::WSDL::Expat::WSDLParser;
|
||||
use SOAP::WSDL::Generator::Template::XSD;
|
||||
use SOAP::WSDL::Factory::Generator;
|
||||
use Term::ReadKey;
|
||||
|
||||
my %opt = (
|
||||
@@ -16,7 +16,8 @@ my %opt = (
|
||||
typemap_prefix => 'MyTypemaps',
|
||||
interface_prefix => 'MyInterfaces',
|
||||
base_path => 'lib/',
|
||||
proxy => undef
|
||||
proxy => undef,
|
||||
generator => 'XSD',
|
||||
);
|
||||
|
||||
{ # a block just to scope "no warnings"
|
||||
@@ -57,6 +58,7 @@ GetOptions(\%opt,
|
||||
keep_alive
|
||||
user=s
|
||||
password=s
|
||||
generator=s
|
||||
)
|
||||
);
|
||||
|
||||
@@ -91,20 +93,29 @@ if ($opt{typemap_include}) {
|
||||
%typemap = do $opt{typemap_include};
|
||||
}
|
||||
|
||||
my $generator = SOAP::WSDL::Generator::Template::XSD->new({
|
||||
type_prefix => $opt{ type_prefix },
|
||||
typemap_prefix => $opt{ typemap_prefix },
|
||||
element_prefix => $opt{ element_prefix },
|
||||
interface_prefix => $opt{ interface_prefix },
|
||||
OUTPUT_PATH => $opt{ base_path },
|
||||
definitions => $definitions,
|
||||
});
|
||||
my $generator = SOAP::WSDL::Factory::Generator->get_generator({ type => $opt{'generator'} });
|
||||
|
||||
if (%typemap) {
|
||||
if ($generator->can('set_typemap')) {
|
||||
$generator->set_typemap( \%typemap );
|
||||
}
|
||||
else {
|
||||
warn "Typemap snippet given, but generator does not support it\n";
|
||||
}
|
||||
};
|
||||
|
||||
$generator->set_type_prefix( $opt{ type_prefix }) if $generator->can('set_type_prefix');
|
||||
$generator->set_typemap_prefix( $opt{ typemap_prefix }) if $generator->can('set_typemap_prefix');
|
||||
$generator->set_element_prefix($opt{ element_prefix }) if $generator->can('set_element_prefix');
|
||||
$generator->set_interface_prefix($opt{ interface_prefix }) if $generator->can('set_interface_prefix');
|
||||
$generator->set_OUTPUT_PATH($opt{ base_path }) if $generator->can('set_OUTPUT_PATH');
|
||||
$generator->set_definitions($definitions) if $generator->can('set_definitions');
|
||||
$generator->set_wsdl($xml) if $generator->can('set_wsdl');
|
||||
|
||||
# start with typelib, as errors will most likely occur here...
|
||||
$generator->generate_typelib();
|
||||
$generator->generate_interface();
|
||||
$generator->generate_typemap({ (%typemap) ? (typemap => \%typemap) : () });
|
||||
$generator->generate();
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
@@ -133,13 +144,15 @@ wsdl2perl.pl - create perl bindings for SOAP webservices.
|
||||
base_path b Path to create classes in.
|
||||
Default: .
|
||||
typemap_include mi File to include in typemap. Must eval() to a valid
|
||||
perl hash (not a has ref !).
|
||||
perl hash (not a hash ref !).
|
||||
proxy x HTTP(S) proxy to use (if any). wsdl2perl will also
|
||||
use the proxy settings specified via the HTTP_PROXY
|
||||
and HTTPS_PROXY environment variables.
|
||||
keep_alive Use http keep_alive.
|
||||
user Username for HTTP authentication
|
||||
password Password. wsdl2perl will prompt if not given.
|
||||
generator g Generator to use.
|
||||
Default: XSD
|
||||
help h Show help content
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
@@ -89,7 +89,7 @@ SOAP::WSDL::Expat::Message2Hash - Convert SOAP messages to perl hash refs
|
||||
|
||||
Real fast expat based SOAP message parser.
|
||||
|
||||
See L<SOAP::WSDL::Parser> for details.
|
||||
See L<SOAP::WSDL::Manual::Parser> for details.
|
||||
|
||||
=head1 Bugs and Limitations
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ SOAP::WSDL::Expat::MessageParser - Convert SOAP messages to custom object trees
|
||||
|
||||
Real fast expat based SOAP message parser.
|
||||
|
||||
See L<SOAP::WSDL::Parser> for details.
|
||||
See L<SOAP::WSDL::Manual::Parser> for details.
|
||||
|
||||
=head2 Skipping unwanted items
|
||||
|
||||
@@ -234,8 +234,8 @@ This module may be used under the same terms as perl itself.
|
||||
|
||||
$ID: $
|
||||
|
||||
$LastChangedDate: 2007-10-03 20:46:56 +0200 (Mit, 03 Okt 2007) $
|
||||
$LastChangedRevision: 305 $
|
||||
$LastChangedDate: 2007-10-07 19:27:58 +0200 (Son, 07 Okt 2007) $
|
||||
$LastChangedRevision: 313 $
|
||||
$LastChangedBy: kutterma $
|
||||
|
||||
$HeadURL: http://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Expat/MessageParser.pm $
|
||||
|
||||
@@ -48,7 +48,7 @@ SOAP::WSDL::Expat::MessageStreamParser - Convert SOAP messages to custom object
|
||||
|
||||
ExpatNB based parser for parsing huge documents.
|
||||
|
||||
See L<SOAP::WSDL::Parser> for details.
|
||||
See L<SOAP::WSDL::Manual::Parser> for details.
|
||||
|
||||
=head1 Bugs and Limitations
|
||||
|
||||
@@ -68,8 +68,8 @@ This module may be used under the same terms as perl itself.
|
||||
|
||||
$ID: $
|
||||
|
||||
$LastChangedDate: 2007-10-03 20:46:56 +0200 (Mit, 03 Okt 2007) $
|
||||
$LastChangedRevision: 305 $
|
||||
$LastChangedDate: 2007-10-07 19:27:58 +0200 (Son, 07 Okt 2007) $
|
||||
$LastChangedRevision: 313 $
|
||||
$LastChangedBy: kutterma $
|
||||
|
||||
$HeadURL: http://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Expat/MessageStreamParser.pm $
|
||||
|
||||
172
lib/SOAP/WSDL/Factory/Generator.pm
Normal file
172
lib/SOAP/WSDL/Factory/Generator.pm
Normal file
@@ -0,0 +1,172 @@
|
||||
package SOAP::WSDL::Factory::Generator;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
our $VERSION='2.00_18';
|
||||
|
||||
my %GENERATOR = (
|
||||
'XSD' => 'SOAP::WSDL::Generator::Template::XSD',
|
||||
);
|
||||
|
||||
# class method
|
||||
sub register {
|
||||
my ($class, $ref_type, $package) = @_;
|
||||
$GENERATOR{ $ref_type } = $package;
|
||||
}
|
||||
|
||||
sub get_generator {
|
||||
my ($self, $args_of_ref) = @_;
|
||||
|
||||
# sanity check
|
||||
# die "no generator registered for generation method $args_of_ref->{ type }"
|
||||
#
|
||||
my $generator_class = (exists ($GENERATOR{ $args_of_ref->{ type } }))
|
||||
? $GENERATOR{ $args_of_ref->{ type } }
|
||||
: $args_of_ref->{ type };
|
||||
|
||||
# load module
|
||||
eval "require $generator_class"
|
||||
or die "Cannot load generator $generator_class", $@;
|
||||
|
||||
return $generator_class->new();
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SOAP::WSDL::Factory:Generator - Factory for retrieving generator objects
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# from SOAP::WSDL::Client:
|
||||
$generator = SOAP::WSDL::Factory::Generator->get_generator({
|
||||
soap_version => $soap_version,
|
||||
});
|
||||
|
||||
# in generator class:
|
||||
package MyWickedGenerator;
|
||||
use SOAP::WSDL::Factory::Generator;
|
||||
|
||||
# register as generator for SOAP1.2 messages
|
||||
SOAP::WSDL::Factory::Generator->register( '1.2' , __PACKAGE__ );
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
SOAP::WSDL::Factory::Generator serves as factory for retrieving
|
||||
generator objects for SOAP::WSDL.
|
||||
|
||||
The actual work is done by specific generator classes.
|
||||
|
||||
SOAP::WSDL::Generator tries to load one of the following classes:
|
||||
|
||||
=over
|
||||
|
||||
=item * the class registered for the scheme via register()
|
||||
|
||||
=back
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
=head2 register
|
||||
|
||||
SOAP::WSDL::Generator->register('Lite', 'MyWickedGenerator');
|
||||
|
||||
Globally registers a class for use as generator class.
|
||||
|
||||
=head2 get_generator
|
||||
|
||||
Returns an object of the generator class for this endpoint.
|
||||
|
||||
=head1 WRITING YOUR OWN GENERATOR CLASS
|
||||
|
||||
=head2 Registering a generator
|
||||
|
||||
Generator classes may register with SOAP::WSDL::Factory::Generator.
|
||||
|
||||
Registering a generator class with SOAP::WSDL::Factory::Generator is done
|
||||
by executing the following code where $version is the SOAP version the
|
||||
class should be used for, and $class is the class name.
|
||||
|
||||
SOAP::WSDL::Factory::Generator->register( $version, $class);
|
||||
|
||||
To auto-register your transport class on loading, execute register() in
|
||||
your generator class (see L<SYNOPSIS|SYNOPSIS> above).
|
||||
|
||||
=head2 Generator package layout
|
||||
|
||||
Generator modules must be named equal to the generator class they contain.
|
||||
There can only be one generator class per generator module.
|
||||
|
||||
=head2 Methods to implement
|
||||
|
||||
Generator classes must implement the following methods:
|
||||
|
||||
=over
|
||||
|
||||
=item * new
|
||||
|
||||
Constructor.
|
||||
|
||||
=item * generate
|
||||
|
||||
Generate SOAP interface
|
||||
|
||||
=back
|
||||
|
||||
Generators may implements one or more of the following configuration
|
||||
methods. All of them are tried via can() by wsdl2perl.
|
||||
|
||||
=over
|
||||
|
||||
=item * set_wsdl
|
||||
|
||||
Set the raw WSDL XML. Implement if you have your own WSDL parser.
|
||||
|
||||
=item * set_definitions
|
||||
|
||||
Sets the (parsed) SOAP::WSDL::Definitions object.
|
||||
|
||||
=item * set_type_prefix
|
||||
|
||||
Sets the prefix for XML Schema type classes
|
||||
|
||||
=item * set_element_prefix
|
||||
|
||||
Sets the prefix for XML Schema element classes
|
||||
|
||||
=item * set_typemap_prefix
|
||||
|
||||
Sets the prefix for typemap classes (class resolvers).
|
||||
|
||||
=item * set_interface_prefix
|
||||
|
||||
Sets the prefix for interface classes
|
||||
|
||||
=item * set_typemap
|
||||
|
||||
Set user-defined typemap snippet
|
||||
|
||||
=back
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
Copyright (c) 2004-2007 Martin Kutter.
|
||||
|
||||
This file is part of SOAP-WSDL. You may distribute/modify it under the same
|
||||
terms as perl itself
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Martin Kutter E<lt>martin.kutter fen-net.deE<gt>
|
||||
|
||||
=head1 REPOSITORY INFORMATION
|
||||
|
||||
$Rev: 302 $
|
||||
$LastChangedBy: kutterma $
|
||||
$Id: Generator.pm 302 2007-09-30 19:25:25Z kutterma $
|
||||
$HeadURL: http://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Factory/Generator.pm $
|
||||
|
||||
=cut
|
||||
@@ -18,18 +18,18 @@ my %OUTPUT_PATH_of :ATTR(:name<OUTPUT_PATH> :default<.>);
|
||||
|
||||
sub START {
|
||||
my ($self, $ident, $arg_ref) = @_;
|
||||
$tt_of{$ident} = Template->new(
|
||||
}
|
||||
|
||||
sub _process :PROTECTED {
|
||||
my ($self, $template, $arg_ref, $output) = @_;
|
||||
my $ident = ident $self;
|
||||
my $tt = $tt_of{$ident} ||= Template->new(
|
||||
DEBUG => 1,
|
||||
EVAL_PERL => $EVAL_PERL_of{ $ident },
|
||||
RECURSION => $RECURSION_of{ $ident },
|
||||
INCLUDE_PATH => $INCLUDE_PATH_of{ $ident },
|
||||
OUTPUT_PATH => $OUTPUT_PATH_of{ $ident },
|
||||
);
|
||||
}
|
||||
|
||||
sub _process :PROTECTED {
|
||||
my ($self, $template, $arg_ref, $output) = @_;
|
||||
my $tt = $self->get_tt();
|
||||
$tt->process( $template,
|
||||
{
|
||||
definitions => $self->get_definitions,
|
||||
|
||||
@@ -9,7 +9,8 @@ use SOAP::WSDL::Generator::Visitor::Typemap;
|
||||
use SOAP::WSDL::Generator::Visitor::Typelib;
|
||||
use base qw(SOAP::WSDL::Generator::Template);
|
||||
|
||||
my %output_of :ATTR(:name<output> :default<()>);
|
||||
my %output_of :ATTR(:name<output> :default<()>);
|
||||
my %typemap_of :ATTR(:name<typemap> :default<({})>);
|
||||
|
||||
sub BUILD {
|
||||
my ($self, $ident, $arg_ref) = @_;
|
||||
@@ -21,6 +22,13 @@ sub BUILD {
|
||||
);
|
||||
}
|
||||
|
||||
sub generate {
|
||||
my $self = shift;
|
||||
$self->generate_typelib();
|
||||
$self->generate_interface();
|
||||
$self->generate_typemap();
|
||||
}
|
||||
|
||||
sub generate_typelib {
|
||||
my ($self) = @_;
|
||||
|
||||
@@ -73,7 +81,8 @@ sub generate_typemap {
|
||||
'Fault/faultcode' => 'SOAP::WSDL::XSD::Typelib::Builtin::anyURI',
|
||||
'Fault/faultactor' => 'SOAP::WSDL::XSD::Typelib::Builtin::TOKEN',
|
||||
'Fault/faultstring' => 'SOAP::WSDL::XSD::Typelib::Builtin::string',
|
||||
'Fault/detail' => 'SOAP::WSDL::XSD::Typelib::Builtin::string',
|
||||
'Fault/detail' => 'SOAP::WSDL::XSD::Typelib::Builtin::string',
|
||||
%{ $typemap_of{ident $self }},
|
||||
}
|
||||
});
|
||||
for my $service (@{ $self->get_definitions->get_service }) {
|
||||
|
||||
@@ -227,7 +227,7 @@ L<SOAP::WSDL::XSD::Typelib::ComplexType>, L<SOAP::WSDL::XSD::Typelib::SimpleType
|
||||
L<SOAP::WSDL::XSD::Typelib::Element> tell you how to create subclasses of XML schema
|
||||
types.
|
||||
|
||||
L<SOAP::WSDL::Parser> will tell you how to create a typemap class.
|
||||
L<SOAP::WSDL::Manual::Parser> will tell you how to create a typemap class.
|
||||
|
||||
=back
|
||||
|
||||
@@ -273,7 +273,7 @@ class. This unfortunately means that you have to set the endpoint URL, too:
|
||||
|
||||
You may, of course, decide to just hack the generated class. Be advised that
|
||||
subclassing might be a more appropriate solution - re-generating overwrites
|
||||
your changes.
|
||||
changes in interface classes.
|
||||
|
||||
=head3 Accessing HTTPS webservices protected by certificate authentication
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SOAP::WSDL::Parser - How SOAP::WSDL parses XML messages
|
||||
SOAP::WSDL::Manual::Parser - How SOAP::WSDL parses XML messages
|
||||
|
||||
=head1 Which XML message does SOAP::WSDL parse ?
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SOAP::WSDL::XSD - SOAP::WSDL's XML Schema implementation
|
||||
SOAP::WSDL::Manual::XSD - SOAP::WSDL's XML Schema implementation
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
@@ -15,6 +15,32 @@ class (usually in it's own file).
|
||||
Atomic types are either directly included in the class of their parent's
|
||||
node, or as sub-package in their parent class' file.
|
||||
|
||||
While the implementation is still incomplete, it covers the XML schema
|
||||
definitions used by most object mappers.
|
||||
|
||||
=head1 USAGE
|
||||
|
||||
You can use SOAP::WSDL::XSD based classes just like any perl class - you may
|
||||
instantiate it, inherit from it etc.
|
||||
|
||||
You should be aware, that SOAP::WSDL::XSD based classes are inside-out
|
||||
classes using Class::Std, though - things you would expect from hash-based
|
||||
classes like using the blessed hash ref as data storage won't work.
|
||||
|
||||
Moreover, most classes override Class::Std's default constructor for speed -
|
||||
you should not expect BUILD or START methods to work, unless you call them
|
||||
yourself (or define a new constructor).
|
||||
|
||||
All SOAP::WSDL::XSD based complexType classes allow a hash ref mathing their
|
||||
data structure as only parameter to new(). You may mix hash and list refs and
|
||||
objects in the structure passed to new - as long as the structure matches, it
|
||||
will work fine.
|
||||
|
||||
All SOAP::WSDL::XSD based simpleType (and builtin) classes accept a single
|
||||
hash ref with the only key "value" and the value to be set as value.
|
||||
|
||||
=head1 HOW IT WORKS
|
||||
|
||||
=head2 Base classes
|
||||
|
||||
SOAP::WSDL::XSD provides a set of base classes for the construction of XML
|
||||
@@ -43,7 +69,14 @@ L</TRANSLATION RULES> for details.
|
||||
|
||||
=head3 complexType construction class
|
||||
|
||||
For the construction of complexType classes, the
|
||||
For the construction of complexType classes, the construction class
|
||||
SOAP::WSDL::XSD::Typelib::ComplexType is provided. It provides a __factory
|
||||
method for placing attributes in generated classes, and generating
|
||||
appropriate setter/getter accessors.
|
||||
|
||||
The setters are special: They handle complex data structures of any type
|
||||
(meaning hash refs, list refs and objects, and any combination of them), as
|
||||
long as their structure matches the expected structure.
|
||||
|
||||
=head1 TRANSLATION RULES
|
||||
|
||||
@@ -81,9 +114,9 @@ SOAP::WSDL::XSD::Typelib::Element and from the base type of the atomic type.
|
||||
|
||||
Element atomic Type
|
||||
base class base class
|
||||
^ ^
|
||||
| |
|
||||
-------------
|
||||
^ ^
|
||||
| |
|
||||
--------------
|
||||
|
|
||||
element simpleType class
|
||||
|
||||
@@ -95,9 +128,9 @@ SOAP::WSDL::XSD::Typelib::ComplexType.
|
||||
|
||||
Element complexType
|
||||
base class base class
|
||||
^ ^
|
||||
| |
|
||||
-------------
|
||||
^ ^
|
||||
| |
|
||||
--------------
|
||||
|
|
||||
element complexType class
|
||||
|
||||
@@ -108,14 +141,36 @@ TODO add more elaborate description
|
||||
Some content models are not implemented yet. The content models
|
||||
implemented are described below.
|
||||
|
||||
=head3 complexType with "sequence" variety
|
||||
|
||||
=head3 complexType with "all" variety
|
||||
|
||||
Complex types with "all" variety inherit from
|
||||
SOAP::WSDL::XSD::Typelib::ComplexType, and call it's factory method for
|
||||
creating fields and accessors/mutators for the complexType's elements.
|
||||
|
||||
All element's type classes are loaded. Complex type classes have a "has a"
|
||||
relationship to their element fields.
|
||||
|
||||
Element fields may either be element classes (for element ref="") or type
|
||||
classes (for element type=""). No extra element classes are created for
|
||||
a complexType's elements.
|
||||
|
||||
complexType
|
||||
base class
|
||||
^
|
||||
|
|
||||
complexType all
|
||||
---------------- has a
|
||||
element name="a" ------------> Element or type class object
|
||||
element name="b" ------------> Element or type class object
|
||||
|
||||
The implementation for all does enforce the order of elements as described
|
||||
in the WSDL, even though this is not required by the XML Schema
|
||||
specification.
|
||||
|
||||
=head3 complexType with "sequence" variety
|
||||
|
||||
The implementation of the "sequence" variety is the same as for all.
|
||||
|
||||
=head3 complexType with "choice" variety
|
||||
|
||||
The implementation for choice currently is the same as for all - which means,
|
||||
@@ -130,6 +185,13 @@ no check for occurence are made.
|
||||
ComplexType classes with restriction variety inherit from their base type.
|
||||
No additional processing or content checking is performed yet.
|
||||
|
||||
complexType
|
||||
base type class
|
||||
^
|
||||
|
|
||||
complexType
|
||||
restriction
|
||||
|
||||
Note that complexType with restriction variety classes don't exhibit their
|
||||
type via the xsi:type attribute yet, so they currently cannot be used as
|
||||
a replacement for their base type.
|
||||
|
||||
@@ -4,6 +4,8 @@ use warnings;
|
||||
use Date::Parse;
|
||||
use Date::Format;
|
||||
|
||||
our $VERSION='2.00_18';
|
||||
|
||||
# Speed up. Class::Std::new is slow - and we don't need it's functionality...
|
||||
BEGIN {
|
||||
use Class::Std::Storable;
|
||||
@@ -40,8 +42,16 @@ sub set_value {
|
||||
# We leave out the optional nanoseconds part, as it would always be empty.
|
||||
else {
|
||||
# strptime sets empty values to undef - and strftime doesn't like that...
|
||||
# we even need to set it to 1 to prevent a "Day '0' out of range 1..31" warning...
|
||||
my @time_from = map { ! defined $_ ? 1 : $_ } strptime($_[1]);
|
||||
# we even need to set it to 1 to prevent a "Day '0' out of range 1..31" warning..
|
||||
|
||||
# we need to set the current date for correct TZ conversion -
|
||||
# could be daylight savings time
|
||||
my @now = localtime;
|
||||
my @time_from = map { my $alternative = shift @now;
|
||||
! defined $_
|
||||
? $alternative
|
||||
: $_ } strptime($_[1]);
|
||||
undef $time_from[-1];
|
||||
my $time_str = strftime( '%H:%M:%S%z', @time_from );
|
||||
substr $time_str, -2, 0, ':';
|
||||
$_[0]->SUPER::set_value($time_str);
|
||||
|
||||
@@ -21,7 +21,6 @@ my $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file:///' . $path .'/t/acceptance/wsdl/006_sax_client.wsdl',
|
||||
outputxml => 1, # required, if not set ::SOM serializer will be loaded on
|
||||
# call
|
||||
readable => 1,
|
||||
)->wsdlinit();
|
||||
|
||||
$soap->servicename('MessageGateway');
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/perl -w
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 6;
|
||||
use Test::More tests => 5;
|
||||
use lib 't/lib';
|
||||
use lib '../lib';
|
||||
use lib 'lib';
|
||||
@@ -39,14 +39,12 @@ else
|
||||
# TODO factor out into different test
|
||||
|
||||
my $soap = SOAP::WSDL->new(
|
||||
readable => 1,
|
||||
wsdl => 'file:///' . $path .'/t/acceptance/wsdl/006_sax_client.wsdl',
|
||||
)->wsdlinit();
|
||||
|
||||
$soap->servicename('MessageGateway');
|
||||
|
||||
ok( $soap->no_dispatch( 1 ) , "Set no_dispatch" );
|
||||
ok( $soap->readable( 0 ) , "Set readable");
|
||||
|
||||
sub xml {
|
||||
q{<SOAP-ENV:Envelope
|
||||
|
||||
@@ -25,7 +25,6 @@ my $soap;
|
||||
#2
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file://' . $path . '/../../acceptance/wsdl/03_complexType-all.wsdl',
|
||||
readable =>1,
|
||||
), 'Instantiated object' );
|
||||
|
||||
#3
|
||||
|
||||
@@ -7,6 +7,6 @@ my $soap = SOAP::WSDL->new();
|
||||
|
||||
|
||||
TODO: {
|
||||
local $TODO="implement <choice> support";
|
||||
local $TODO="implement tests";
|
||||
fail "serialize choice element";
|
||||
}
|
||||
@@ -17,6 +17,6 @@ my $soap = SOAP::WSDL->new();
|
||||
|
||||
|
||||
TODO: {
|
||||
local $TODO="implement <complexContent> support";
|
||||
local $TODO="implement <complexContent> tests";
|
||||
fail "serialize complexContent element";
|
||||
}
|
||||
@@ -20,7 +20,6 @@ my $soap;
|
||||
#2
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file://' . $path . '/../../acceptance/wsdl/03_complexType-element-ref.wsdl',
|
||||
readable => 1,
|
||||
no_dispatch => 1,
|
||||
), 'Instantiated object' );
|
||||
|
||||
|
||||
@@ -14,14 +14,10 @@ my $soap = undef;
|
||||
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
|
||||
#2
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file:///' . $path . '/../../acceptance/wsdl/04_element-simpleType.wsdl'
|
||||
), 'Instantiated object' );
|
||||
|
||||
#3
|
||||
$soap->readable(1);
|
||||
|
||||
# won't work without - would require SOAP::WSDL::Deserializer::SOM,
|
||||
# which requires SOAP::Lite
|
||||
$soap->outputxml(1);
|
||||
|
||||
@@ -17,7 +17,6 @@ ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file:///' . $path . '/../../acceptance/wsdl/05_simpleType-list.wsdl'
|
||||
), 'Instantiated object' );
|
||||
|
||||
$soap->readable(1);
|
||||
# won't work without - would require SOAP::WSDL::Deserializer::SOM,
|
||||
# which requires SOAP::Lite
|
||||
$soap->outputxml(1);
|
||||
|
||||
@@ -20,7 +20,6 @@ ok( $soap = SOAP::WSDL->new(
|
||||
), 'Instantiated object' );
|
||||
|
||||
#3
|
||||
$soap->readable(1);
|
||||
ok( $soap->wsdlinit(
|
||||
servicename => 'testService',
|
||||
), 'parsed WSDL' );
|
||||
|
||||
@@ -16,7 +16,6 @@ ok $soap = SOAP::WSDL->new(
|
||||
), 'Instantiated object';
|
||||
|
||||
#3
|
||||
$soap->readable(1);
|
||||
ok $soap->wsdlinit(), 'parsed WSDL';
|
||||
$soap->no_dispatch(1);
|
||||
# won't work without - would require SOAP::WSDL::Deserializer::SOM,
|
||||
|
||||
25
t/SOAP/WSDL/Generator/XCS.t
Normal file
25
t/SOAP/WSDL/Generator/XCS.t
Normal file
@@ -0,0 +1,25 @@
|
||||
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();
|
||||
@@ -2,6 +2,17 @@ use Test::More tests => 3;
|
||||
use strict;
|
||||
use warnings;
|
||||
use lib '../lib';
|
||||
use Date::Parse;
|
||||
use Date::Format;
|
||||
|
||||
sub timezone {
|
||||
my @time = localtime;
|
||||
my $tz = strftime('%z', @time);
|
||||
substr $tz, -2, 0, ':';
|
||||
return $tz;
|
||||
}
|
||||
|
||||
my $timezone = timezone;
|
||||
|
||||
use_ok('SOAP::WSDL::XSD::Typelib::Builtin::time');
|
||||
my $obj;
|
||||
@@ -9,7 +20,7 @@ my $obj;
|
||||
$obj = SOAP::WSDL::XSD::Typelib::Builtin::time->new();
|
||||
|
||||
$obj->set_value( '12:23:03' );
|
||||
is $obj->get_value() , '12:23:03+01:00', 'conversion';
|
||||
is $obj->get_value() , "12:23:03$timezone", 'conversion';
|
||||
|
||||
$obj->set_value( '12:23:03.12345+01:00' ), ;
|
||||
is $obj->get_value() , '12:23:03.12345+01:00', 'no conversion';
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
|
||||
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
|
||||
xmlns="http://schemas.xmlsoap.org/wsdl/"
|
||||
>
|
||||
<types>
|
||||
<xsd:schema targetNamespace="urn:Test">
|
||||
@@ -197,9 +198,9 @@
|
||||
</portType>
|
||||
|
||||
<binding type="tns:testPort" name="testBinding">
|
||||
<operation name="testChoice">
|
||||
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
|
||||
<soap:operation soapAction="testChoice"/>
|
||||
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
|
||||
<operation name="testChoice">
|
||||
<soap:operation soapAction="testChoice" style="document"/>
|
||||
<input>
|
||||
<soap:body use="literal"/>
|
||||
</input>
|
||||
@@ -209,8 +210,7 @@
|
||||
</operation>
|
||||
|
||||
<operation name="test">
|
||||
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
|
||||
<soap:operation soapAction="test"/>
|
||||
<soap:operation soapAction="test" style="document"/>
|
||||
<input>
|
||||
<soap:body use="literal"/>
|
||||
</input>
|
||||
@@ -218,10 +218,8 @@
|
||||
<soap:body use="literal"/>
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<operation name="testHeader">
|
||||
<soap:operation soapAction="testHeader"/>
|
||||
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
|
||||
<input>
|
||||
<soap:body use="literal" parts="tns:testBody"/>
|
||||
<soap:header use="literal" part="tns:testHeader" message="tns:testHeaderRequest"/>
|
||||
|
||||
Reference in New Issue
Block a user