import SOAP-WSDL 2.00_17 from CPAN
git-cpan-module: SOAP-WSDL git-cpan-version: 2.00_17 git-cpan-authorid: MKUTTER git-cpan-file: authors/id/M/MK/MKUTTER/SOAP-WSDL-2.00_17.tar.gz
This commit is contained in:
1 parent
c6a48ba84b
commit
008d06b72a
319 files changed
+23045
-2383
No files matched your search
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/perl
|
||||
package MyComplexType;
|
||||
use strict;
|
||||
use Class::Std::Storable;
|
||||
use lib '../../lib';
|
||||
use SOAP::WSDL::XSD::Typelib::ComplexType;
|
||||
use base ('SOAP::WSDL::XSD::Typelib::ComplexType');
|
||||
|
||||
my %MyTestName_of :ATTR(:get<MyTestName>);
|
||||
|
||||
__PACKAGE__->_factory(
|
||||
[ qw(MyTestName) ], # order
|
||||
{ MyTestName => \%MyTestName_of }, # attribute lookup map
|
||||
{ MyTestName => 'SOAP::WSDL::XSD::Typelib::Builtin::string' } # class name lookup map
|
||||
);
|
||||
|
||||
sub get_xmlns { 'urn:Test' };
|
||||
|
||||
1;
|
||||
@@ -0,0 +1,84 @@
|
||||
#!/usr/bin/perl
|
||||
package MyElement;
|
||||
use strict;
|
||||
use SOAP::WSDL::XSD::Typelib::Element;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin;
|
||||
use base (
|
||||
'SOAP::WSDL::XSD::Typelib::Element',
|
||||
'SOAP::WSDL::XSD::Typelib::Builtin::string',
|
||||
);
|
||||
|
||||
__PACKAGE__->__set_name('MyElementName');
|
||||
sub get_xmlns { 'urn:Test' };
|
||||
|
||||
package MyComplexTypeElement;
|
||||
use strict;
|
||||
use SOAP::WSDL::XSD::Typelib::Element;
|
||||
use MyComplexType;
|
||||
use base (
|
||||
'SOAP::WSDL::XSD::Typelib::Element',
|
||||
'MyComplexType',
|
||||
);
|
||||
|
||||
__PACKAGE__->__set_name('MyComplexTypeElement');
|
||||
sub get_xmlns { 'urn:Test' };
|
||||
|
||||
package MyTestElement;
|
||||
use strict;
|
||||
use SOAP::WSDL::XSD::Typelib::Element;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::string;
|
||||
use base (
|
||||
'SOAP::WSDL::XSD::Typelib::Element',
|
||||
'SOAP::WSDL::XSD::Typelib::Builtin::string',
|
||||
);
|
||||
|
||||
__PACKAGE__->__set_name('MyTestElement');
|
||||
|
||||
sub get_xmlns { 'urn:Test' };
|
||||
|
||||
package MyTestElement2;
|
||||
use strict;
|
||||
use SOAP::WSDL::XSD::Typelib::Element;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin;
|
||||
use base (
|
||||
'SOAP::WSDL::XSD::Typelib::Element',
|
||||
'SOAP::WSDL::XSD::Typelib::Builtin::string',
|
||||
);
|
||||
|
||||
__PACKAGE__->__set_name('MyTestElement2');
|
||||
|
||||
sub get_xmlns { 'urn:Test' };
|
||||
|
||||
|
||||
package MyAtomicComplexTypeElement;
|
||||
|
||||
use strict;
|
||||
use SOAP::WSDL::XSD::Typelib::Element;
|
||||
use SOAP::WSDL::XSD::Typelib::ComplexType;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin;
|
||||
use base (
|
||||
'SOAP::WSDL::XSD::Typelib::Element',
|
||||
'SOAP::WSDL::XSD::Typelib::ComplexType',
|
||||
);
|
||||
|
||||
my %test_of :ATTR(:get<test>);
|
||||
my %test2_of :ATTR(:get<test2>);
|
||||
|
||||
sub get_xmlns { 'urn:Test' };
|
||||
|
||||
__PACKAGE__->_factory(
|
||||
[ qw(test test2) ],
|
||||
{
|
||||
test => \%test_of,
|
||||
test2 => \%test2_of,
|
||||
},
|
||||
{
|
||||
# this is the <element ref="" variant....
|
||||
test => 'MyTestElement',
|
||||
test2 => 'MyTestElement2',
|
||||
},
|
||||
);
|
||||
|
||||
__PACKAGE__->__set_name('MyAtomicComplexTypeElement');
|
||||
|
||||
1;
|
||||
@@ -0,0 +1,105 @@
|
||||
package MyElements::GetWeather;
|
||||
use strict;
|
||||
use Class::Std::Storable;
|
||||
use SOAP::WSDL::XSD::Typelib::Element;
|
||||
|
||||
|
||||
# atomic complexType
|
||||
# <element name="GetWeather"><complexType> definition
|
||||
use SOAP::WSDL::XSD::Typelib::ComplexType;
|
||||
use base qw(
|
||||
SOAP::WSDL::XSD::Typelib::Element
|
||||
SOAP::WSDL::XSD::Typelib::ComplexType
|
||||
);
|
||||
|
||||
|
||||
my %CityName_of :ATTR(:get<CityName>);
|
||||
|
||||
my %CountryName_of :ATTR(:get<CountryName>);
|
||||
|
||||
|
||||
__PACKAGE__->_factory(
|
||||
[ qw(
|
||||
CityName
|
||||
|
||||
CountryName
|
||||
) ],
|
||||
{
|
||||
CityName => \%CityName_of,
|
||||
CountryName => \%CountryName_of,
|
||||
|
||||
},
|
||||
{
|
||||
|
||||
CityName => 'SOAP::WSDL::XSD::Typelib::Builtin::string',
|
||||
|
||||
|
||||
CountryName => 'SOAP::WSDL::XSD::Typelib::Builtin::string',
|
||||
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
sub get_xmlns { 'http://www.webserviceX.NET' }
|
||||
|
||||
__PACKAGE__->__set_name('GetWeather');
|
||||
__PACKAGE__->__set_nillable();
|
||||
__PACKAGE__->__set_minOccurs();
|
||||
__PACKAGE__->__set_maxOccurs();
|
||||
__PACKAGE__->__set_ref('');
|
||||
|
||||
1;
|
||||
|
||||
|
||||
__END__
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
MyElements::GetWeather
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Type class for the XML element GetWeather.
|
||||
|
||||
=head1 PROPERTIES
|
||||
|
||||
The following properties may be accessed using get_PROPERTY / set_PROPERTY
|
||||
methods:
|
||||
|
||||
CityName
|
||||
CountryName
|
||||
|
||||
=head1 Object structure
|
||||
|
||||
CityName => 'SOAP::WSDL::XSD::Typelib::Builtin::string',
|
||||
|
||||
CountryName => 'SOAP::WSDL::XSD::Typelib::Builtin::string',
|
||||
|
||||
|
||||
Structure as perl hash:
|
||||
|
||||
The object structure is displayed as hash below though this is not correct.
|
||||
Complex hash elements actually are objects of their corresponding classes
|
||||
(look for classes of the same name in your typleib).
|
||||
new() will accept a hash structure like this, but transform it to a object
|
||||
tree.
|
||||
|
||||
'GetWeather'=> {
|
||||
'CityName' => $someValue,
|
||||
'CountryName' => $someValue,
|
||||
},
|
||||
|
||||
|
||||
=cut
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
package MyElements::GetWeatherResponse;
|
||||
use strict;
|
||||
use Class::Std::Storable;
|
||||
use SOAP::WSDL::XSD::Typelib::Element;
|
||||
|
||||
|
||||
# atomic complexType
|
||||
# <element name="GetWeatherResponse"><complexType> definition
|
||||
use SOAP::WSDL::XSD::Typelib::ComplexType;
|
||||
use base qw(
|
||||
SOAP::WSDL::XSD::Typelib::Element
|
||||
SOAP::WSDL::XSD::Typelib::ComplexType
|
||||
);
|
||||
|
||||
|
||||
my %GetWeatherResult_of :ATTR(:get<GetWeatherResult>);
|
||||
|
||||
|
||||
__PACKAGE__->_factory(
|
||||
[ qw(
|
||||
GetWeatherResult
|
||||
) ],
|
||||
{
|
||||
GetWeatherResult => \%GetWeatherResult_of,
|
||||
|
||||
},
|
||||
{
|
||||
|
||||
GetWeatherResult => 'SOAP::WSDL::XSD::Typelib::Builtin::string',
|
||||
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
sub get_xmlns { 'http://www.webserviceX.NET' }
|
||||
|
||||
__PACKAGE__->__set_name('GetWeatherResponse');
|
||||
__PACKAGE__->__set_nillable();
|
||||
__PACKAGE__->__set_minOccurs();
|
||||
__PACKAGE__->__set_maxOccurs();
|
||||
__PACKAGE__->__set_ref('');
|
||||
|
||||
1;
|
||||
|
||||
|
||||
__END__
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
MyElements::GetWeatherResponse
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Type class for the XML element GetWeatherResponse.
|
||||
|
||||
=head1 PROPERTIES
|
||||
|
||||
The following properties may be accessed using get_PROPERTY / set_PROPERTY
|
||||
methods:
|
||||
|
||||
GetWeatherResult
|
||||
|
||||
=head1 Object structure
|
||||
|
||||
GetWeatherResult => 'SOAP::WSDL::XSD::Typelib::Builtin::string',
|
||||
|
||||
|
||||
Structure as perl hash:
|
||||
|
||||
The object structure is displayed as hash below though this is not correct.
|
||||
Complex hash elements actually are objects of their corresponding classes
|
||||
(look for classes of the same name in your typleib).
|
||||
new() will accept a hash structure like this, but transform it to a object
|
||||
tree.
|
||||
|
||||
'GetWeatherResponse'=> {
|
||||
'GetWeatherResult' => $someValue,
|
||||
},
|
||||
|
||||
|
||||
=cut
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
package MyInterfaces::GlobalWeather;
|
||||
use strict;
|
||||
use warnings;
|
||||
use MyTypemaps::GlobalWeather;
|
||||
use base 'SOAP::WSDL::Client::Base';
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my $arg_ref = shift || {};
|
||||
my $self = $class->SUPER::new({
|
||||
class_resolver => 'MyTypemaps::GlobalWeather',
|
||||
proxy => 'http://www.webservicex.net/globalweather.asmx',
|
||||
%{ $arg_ref }
|
||||
});
|
||||
return bless $self, $class;
|
||||
}
|
||||
|
||||
__PACKAGE__->__create_methods(
|
||||
GetWeather => {
|
||||
parts => [ 'MyElements::GetWeather', ],
|
||||
soap_action => 'http://www.webserviceX.NET/GetWeather',
|
||||
style => 'document',
|
||||
# use => '', # use not implemented yet
|
||||
},
|
||||
GetCitiesByCountry => {
|
||||
parts => [ 'MyElements::GetCitiesByCountry', ],
|
||||
soap_action => 'http://www.webserviceX.NET/GetCitiesByCountry',
|
||||
style => 'document',
|
||||
# use => '', # use not implemented yet
|
||||
},
|
||||
|
||||
);
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
MyInterfaces::GlobalWeather - SOAP interface to GlobalWeather at
|
||||
http://www.webservicex.net/globalweather.asmx
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
my $interface = MyInterfaces::GlobalWeather->new();
|
||||
my $GetCitiesByCountry = $interface->GetCitiesByCountry();
|
||||
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
=head2 GetWeather
|
||||
|
||||
Get weather report for all major cities around the world.
|
||||
|
||||
SYNOPSIS:
|
||||
|
||||
$service->GetWeather({
|
||||
'CityName' => $someValue,
|
||||
'CountryName' => $someValue,
|
||||
});
|
||||
|
||||
|
||||
=head2 GetCitiesByCountry
|
||||
|
||||
Get all major cities by country name(full / part).
|
||||
|
||||
SYNOPSIS:
|
||||
|
||||
$service->GetCitiesByCountry({
|
||||
'CountryName' => $someValue,
|
||||
});
|
||||
|
||||
|
||||
|
||||
=pod
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/perl
|
||||
package MySimpleType;
|
||||
use Class::Std::Storable;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin;
|
||||
use SOAP::WSDL::XSD::Typelib::SimpleType;
|
||||
# restriction base implemented via inheritance
|
||||
# derive by restriction
|
||||
# restriction base
|
||||
use base qw(
|
||||
SOAP::WSDL::XSD::Typelib::SimpleType::restriction
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::string
|
||||
);
|
||||
|
||||
|
||||
# example simpleType derived by list.
|
||||
# XSD would be:
|
||||
# <simpleType name="MySimpleListType">
|
||||
# <list itemTipe="xsd:string">
|
||||
# </simpleType>
|
||||
package MySimpleListType;
|
||||
use Class::Std::Storable;
|
||||
# restriction base implemented via inheritance
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin;
|
||||
# derive by list
|
||||
# list itemType
|
||||
use base qw(
|
||||
SOAP::WSDL::XSD::Typelib::SimpleType
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::list
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::string
|
||||
);
|
||||
|
||||
package MyAtomicSimpleType;
|
||||
use Class::Std::Storable;
|
||||
# restriction base implemented via inheritance
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin;
|
||||
# derive by restriction
|
||||
# restriction with atomic simpleType
|
||||
use base qw(
|
||||
SOAP::WSDL::XSD::Typelib::SimpleType::restriction
|
||||
MySimpleType
|
||||
);
|
||||
|
||||
package MyAtomicSimpleListType;
|
||||
use Class::Std::Storable;
|
||||
# restriction base implemented via inheritance
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin;
|
||||
# derive by restriction
|
||||
# restriction with atomic simpleType
|
||||
use base qw(
|
||||
SOAP::WSDL::XSD::Typelib::SimpleType::restriction
|
||||
MySimpleListType
|
||||
);
|
||||
1;
|
||||
@@ -0,0 +1,83 @@
|
||||
package MyInterfaces::GlobalWeather;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use MyTypemaps::GlobalWeather;
|
||||
use base 'SOAP::WSDL::Client::Base';
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my $arg_ref = shift || {};
|
||||
my $self = $class->SUPER::new({
|
||||
class_resolver => 'MyTypemaps::GlobalWeather',
|
||||
proxy => 'http://www.webservicex.net/globalweather.asmx',
|
||||
%{ $arg_ref }
|
||||
});
|
||||
return bless $self, $class;
|
||||
}
|
||||
|
||||
__PACKAGE__->__create_methods(
|
||||
GetWeather => {
|
||||
parts => [ 'MyElements::GetWeather', ],
|
||||
soap_action => 'http://www.webserviceX.NET/GetWeather',
|
||||
style => 'document',
|
||||
# use => '', # use not implemented yet
|
||||
},
|
||||
GetCitiesByCountry => {
|
||||
parts => [ 'MyElements::GetCitiesByCountry', ],
|
||||
soap_action => 'http://www.webserviceX.NET/GetCitiesByCountry',
|
||||
style => 'document',
|
||||
# use => '', # use not implemented yet
|
||||
},
|
||||
|
||||
);
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
MyInterfaces::GlobalWeather - SOAP interface to GlobalWeather at
|
||||
http://www.webservicex.net/globalweather.asmx
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
my $interface = MyInterfaces::GlobalWeather->new();
|
||||
my $GetCitiesByCountry = $interface->GetCitiesByCountry();
|
||||
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
=head2 GetWeather
|
||||
|
||||
Get weather report for all major cities around the world.
|
||||
|
||||
SYNOPSIS:
|
||||
|
||||
$service->GetWeather({
|
||||
'CityName' => $someValue,
|
||||
'CountryName' => $someValue,
|
||||
});
|
||||
|
||||
|
||||
=head2 GetCitiesByCountry
|
||||
|
||||
Get all major cities by country name(full / part).
|
||||
|
||||
SYNOPSIS:
|
||||
|
||||
$service->GetCitiesByCountry({
|
||||
'CountryName' => $someValue,
|
||||
});
|
||||
|
||||
|
||||
|
||||
=pod
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package Test::SOAPMessage;
|
||||
|
||||
use strict;
|
||||
|
||||
use SOAP::Lite;
|
||||
use Test::Differences;
|
||||
use Tie::IxHash;
|
||||
|
||||
use base qw/Exporter/;
|
||||
|
||||
our @EXPORT = qw/soap_eq_or_diff/;
|
||||
|
||||
sub soap_eq_or_diff
|
||||
{
|
||||
my $got = shift;
|
||||
my $expected = shift;
|
||||
my $message = shift;
|
||||
my $soapGot = SOAP::Deserializer->deserialize( $got );
|
||||
my $soapExpected = SOAP::Deserializer->deserialize( $expected );
|
||||
|
||||
return eq_or_diff(
|
||||
unlather( $soapGot ),
|
||||
unlather( $soapExpected ),
|
||||
$message
|
||||
);
|
||||
}
|
||||
|
||||
sub unlather
|
||||
{
|
||||
my $som = shift;
|
||||
my $path = shift || '/Envelope/Body/[1]';
|
||||
my $data = shift;
|
||||
|
||||
unless ( $data )
|
||||
{
|
||||
my %hashData = ();
|
||||
tie (%hashData, q/Tie::IxHash/);
|
||||
$data = \%hashData;
|
||||
}
|
||||
|
||||
my $value;
|
||||
my $tag;
|
||||
my $i = 1;
|
||||
while( $som->match("$path/[$i]") )
|
||||
{
|
||||
$tag = $som->dataof->name();
|
||||
$data ||= {};
|
||||
$value = unlather($som,$path.'/'. '[' . $i . ']' ) || $som->valueof("$path/[$i]");
|
||||
if ($data->{ $tag })
|
||||
{
|
||||
$data->{ $tag } = [ $data->{ $tag } ] unless ( ref ( $data->{ $tag } ) eq 'ARRAY' );
|
||||
push @{ $data->{ $tag } }, $value;
|
||||
}
|
||||
else
|
||||
{
|
||||
$data->{ $tag } = $value;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$data ||= $som->valueof($path);
|
||||
return $data;
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -0,0 +1,28 @@
|
||||
package Typelib::Base;
|
||||
use Class::Std::Storable;
|
||||
|
||||
sub mk_add_mutators {
|
||||
my $class = shift;
|
||||
my $attributes = shift;
|
||||
for my $method ( keys %{$ attributes }) {
|
||||
*{ "$class\::add_$method" } = sub {
|
||||
my ($self, $value) = @_;
|
||||
my $ident = ident $self;
|
||||
|
||||
# we're the first value
|
||||
return $attributes->{ $method }->{ $ident } = $value
|
||||
if not defined $attributes->{ $method }->{ $ident };
|
||||
|
||||
# we're the second value
|
||||
return $attributes->{ $method }->{ $ident } = [
|
||||
$attributes->{ $method }->{ $ident }, $value ]
|
||||
if not ref $attributes->{ $method }->{ $ident } eq 'ARRAY';
|
||||
|
||||
# we're third or later
|
||||
push @{ $attributes->{ $method }->{ $ident } }, $value;
|
||||
return $attributes->{ $method }->{ $ident };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -0,0 +1,17 @@
|
||||
package Typelib::TEnqueueMessage;
|
||||
use strict;
|
||||
use base qw(Typelib::Base);
|
||||
|
||||
my %MMessage_of :ATTR(:name<MMessage> :default<()>);
|
||||
|
||||
my %attributes_of :ATTR();
|
||||
|
||||
%attributes_of = (
|
||||
MMessage => \%MMessage_of,
|
||||
);
|
||||
|
||||
# make a add_BLA method for every attribute
|
||||
__PACKAGE__->mk_add_mutators( \%attributes_of );
|
||||
|
||||
|
||||
1;
|
||||
@@ -0,0 +1,26 @@
|
||||
package Typelib::TMessage;
|
||||
use strict;
|
||||
use base qw(Typelib::Base);
|
||||
|
||||
my %MRecipientURI_of :ATTR(:name<MRecipientURI> :default<()>);
|
||||
my %MMessageContent_of :ATTR(:name<MMessageContent> :default<()>);
|
||||
my %MSenderAddress_of :ATTR(:name<MSenderAddress> :default<()>);
|
||||
my %MSubject_of :ATTR(:name<MSubject> :default<()>);
|
||||
my %MDeliveryReportRecipientURI_of :ATTR(:name<MDeliveryReportRecipientURI> :default<()>);
|
||||
my %MKeepalive_of :ATTR(:name<MKeepalive> :default<()>);
|
||||
|
||||
my %attributes_of :ATTR();
|
||||
|
||||
%attributes_of = (
|
||||
MRecipientURI => \%MRecipientURI_of,
|
||||
MMessageContent => \%MMessageContent_of,
|
||||
MSenderAddress => \%MSenderAddress_of,
|
||||
MSubject => \%MSubject_of,
|
||||
MDeliveryReportRecipientURI => \%MDeliveryReportRecipientURI_of,
|
||||
MKeepalive => \%MKeepalive_of,
|
||||
);
|
||||
|
||||
# make a add_BLA method for every attribute
|
||||
__PACKAGE__->mk_add_mutators( \%attributes_of );
|
||||
|
||||
1;
|
||||
Reference in new issue
Block a user