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
@@ -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 $
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user