import SOAP-WSDL 1.27 from CPAN
git-cpan-module: SOAP-WSDL git-cpan-version: 1.27 git-cpan-authorid: MKUTTER git-cpan-file: authors/id/M/MK/MKUTTER/SOAP-WSDL-1.27.tar.gz
This commit is contained in:
committed by
Michael G. Schwern
parent
7ca2154ad6
commit
2bad767211
38
t/001_use.t
38
t/001_use.t
@@ -1,38 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More; # TODO: change to tests => N;
|
||||
use lib '../lib';
|
||||
|
||||
my @modules = qw(
|
||||
SOAP::WSDL
|
||||
SOAP::WSDL::Client
|
||||
SOAP::WSDL::Serializer::XSD
|
||||
SOAP::WSDL::Deserializer::XSD
|
||||
SOAP::WSDL::Transport::HTTP
|
||||
SOAP::WSDL::Definitions
|
||||
SOAP::WSDL::Message
|
||||
SOAP::WSDL::Operation
|
||||
SOAP::WSDL::OpMessage
|
||||
SOAP::WSDL::SOAP::Address
|
||||
SOAP::WSDL::SOAP::Body
|
||||
SOAP::WSDL::SOAP::Header
|
||||
SOAP::WSDL::SOAP::Operation
|
||||
SOAP::WSDL::Binding
|
||||
SOAP::WSDL::Port
|
||||
SOAP::WSDL::PortType
|
||||
SOAP::WSDL::Types
|
||||
SOAP::WSDL::XSD::Builtin
|
||||
SOAP::WSDL::XSD::ComplexType
|
||||
SOAP::WSDL::XSD::SimpleType
|
||||
SOAP::WSDL::XSD::Element
|
||||
SOAP::WSDL::XSD::Schema
|
||||
);
|
||||
|
||||
plan tests => 2* scalar @modules;
|
||||
|
||||
for my $module (@modules)
|
||||
{
|
||||
use_ok($module);
|
||||
ok($module->new(), "Object creation");
|
||||
}
|
||||
@@ -1,347 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 22;
|
||||
use lib '../lib';
|
||||
|
||||
eval {
|
||||
require Test::XML;
|
||||
import Test::XML;
|
||||
};
|
||||
|
||||
use_ok(qw/SOAP::WSDL::Expat::WSDLParser/);
|
||||
|
||||
my $filter;
|
||||
|
||||
my $parser = SOAP::WSDL::Expat::WSDLParser->new();
|
||||
|
||||
$parser->parse_string( xml() );
|
||||
|
||||
my $wsdl;
|
||||
ok( $wsdl = $parser->get_data() , "get object tree");
|
||||
|
||||
my $types = $wsdl->first_types();
|
||||
|
||||
is $types->get_parent(), $wsdl , 'types parent';
|
||||
|
||||
my $serializer_options = {
|
||||
readable => 1,
|
||||
autotype => 1,
|
||||
namespace => { 'tns' => 'urn:myNamespace',
|
||||
'xsd' => "http://www.w3.org/2001/XMLSchema" },
|
||||
typelib => $wsdl->first_types(),
|
||||
indent => "\t",
|
||||
};
|
||||
|
||||
my $xml;
|
||||
my $type = $types->find_type( 'urn:myNamespace', 'testSimpleType1' );
|
||||
|
||||
|
||||
ok($xml = $type->serialize( 'test', 1 , $serializer_options ),
|
||||
"serialize simple Type"
|
||||
);
|
||||
|
||||
# print $xml;
|
||||
|
||||
SKIP: {
|
||||
skip_without_test_xml();
|
||||
is_xml( $xml, '<test type="tns:testSimpleType1">1</test>',
|
||||
"content compare" );
|
||||
};
|
||||
|
||||
$type = $types->find_type( 'urn:myNamespace', 'testSimpleList' );
|
||||
ok($xml = $type->serialize( 'testList', [ 1, 2, 3 ] , $serializer_options ),
|
||||
"serialize simple list type"
|
||||
);
|
||||
SKIP: {
|
||||
skip_without_test_xml();
|
||||
is_xml( $xml, '<testList type="tns:testSimpleList">1 2 3</testList>',
|
||||
"content compare" );
|
||||
};
|
||||
|
||||
$type = $types->find_element( 'urn:myNamespace', 'TestElement' );
|
||||
|
||||
ok($xml = $type->serialize( undef, 1 , $serializer_options ),
|
||||
"serialize simple element");
|
||||
SKIP: {
|
||||
skip_without_test_xml();
|
||||
is_xml( $xml, '<TestElement type="xsd:int">1</TestElement>',
|
||||
"content compare" );
|
||||
};
|
||||
|
||||
ok( $xml = $types->find_type( 'urn:myNamespace', 'length3')->serialize(
|
||||
'TestComplex', { size => -13, unit => 'BLA' } ,
|
||||
$serializer_options
|
||||
),
|
||||
"serialize complex type");
|
||||
|
||||
SKIP: {
|
||||
skip_without_test_xml();
|
||||
is_xml( $xml, q{
|
||||
<TestComplex type="tns:length3">
|
||||
<size type="xsd:nonPositiveInteger">-13</size>
|
||||
<unit type="xsd:NMTOKEN">BLA</unit>
|
||||
</TestComplex>},
|
||||
"content compare" );
|
||||
};
|
||||
|
||||
ok($xml = $types->find_element( 'urn:myNamespace', 'TestElementComplexType')
|
||||
->serialize(
|
||||
undef, { size => -13, unit => 'BLA' } , $serializer_options ),
|
||||
"serialize element with complex type"
|
||||
);
|
||||
SKIP: {
|
||||
skip_without_test_xml();
|
||||
is_xml( $xml, q{
|
||||
<TestElementComplexType type="tns:length3">
|
||||
<size type="xsd:nonPositiveInteger">-13</size>
|
||||
<unit type="xsd:NMTOKEN">BLA</unit>
|
||||
</TestElementComplexType>
|
||||
},
|
||||
"content compare" );
|
||||
};
|
||||
|
||||
|
||||
ok($xml = $types->find_type( 'urn:myNamespace', 'complex')->serialize(
|
||||
'complexComplex',
|
||||
{ 'length' => { size => -13, unit => 'BLA' }, 'int' => 1 },
|
||||
$serializer_options ),
|
||||
"serialize complex type with complex content"
|
||||
);
|
||||
SKIP: {
|
||||
skip_without_test_xml();
|
||||
is_xml( $xml, q{
|
||||
<complexComplex type="tns:complex">
|
||||
<length type="tns:length3">
|
||||
<size type="xsd:nonPositiveInteger">-13</size>
|
||||
<unit type="xsd:NMTOKEN">BLA</unit>
|
||||
</length>
|
||||
<int type="xsd:int">1</int>
|
||||
</complexComplex>
|
||||
},
|
||||
"content compare" );
|
||||
}
|
||||
ok($xml = $wsdl->find_message('urn:myNamespace', 'testRequest')
|
||||
->get_part()->[0]->serialize(
|
||||
undef,
|
||||
{ test => { length => { size => -13, unit => 'BLA' } , int => 3 } },
|
||||
$serializer_options ),
|
||||
"serialize part"
|
||||
);
|
||||
SKIP: {
|
||||
skip_without_test_xml();
|
||||
is_xml( $xml, q{
|
||||
<test type="tns:complex">
|
||||
<length type="tns:length3">
|
||||
<size type="xsd:nonPositiveInteger">-13</size>
|
||||
<unit type="xsd:NMTOKEN">BLA</unit>
|
||||
</length>
|
||||
<int type="xsd:int">3</int>
|
||||
</test>
|
||||
},
|
||||
"content compare")
|
||||
};
|
||||
|
||||
my $opt = {
|
||||
typelib => $types,
|
||||
readable => 1,
|
||||
autotype => 0,
|
||||
namespace => { 'urn:myNamespace' => 'tns',
|
||||
'http://www.w3.org/2001/XMLSchema' => 'xsd',
|
||||
'http://schemas.xmlsoap.org/wsdl/' => 'wsdl',
|
||||
},
|
||||
indent => "",
|
||||
wsdl => $wsdl,
|
||||
};
|
||||
|
||||
# ok $wsdl->explain($opt) =~ m/#optional/m;
|
||||
|
||||
eval { $wsdl->expand('hallo:welt')};
|
||||
like $@, qr{unbound}, 'Die on attempt to resolve unbound prefix';
|
||||
|
||||
my $complex = $types->find_type( 'urn:myNamespace', 'complex');
|
||||
|
||||
ok $complex->find_element('urn:myNamespace', 'length'), 'Find element in complexType';
|
||||
ok ! $complex->find_element('urn:myNamespace', 'FOO'), 'Find element in complexType';
|
||||
|
||||
eval { $complex->foo() };
|
||||
like $@, qr{ foo }xms;
|
||||
|
||||
eval { SOAP::WSDL::ComplexType->foo() };
|
||||
like $@, qr{ foo }xms;
|
||||
|
||||
|
||||
sub skip_without_test_xml {
|
||||
skip("Test::XML not available", 1) if (not $Test::XML::VERSION);
|
||||
}
|
||||
|
||||
sub xml
|
||||
{
|
||||
return q{<?xml version="1.0"?>
|
||||
<definitions name="simpleType"
|
||||
targetNamespace="urn:myNamespace"
|
||||
xmlns="http://schemas.xmlsoap.org/wsdl/"
|
||||
xmlns:tns="urn:myNamespace"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
|
||||
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
|
||||
>
|
||||
<types>
|
||||
<xsd:schema targetNamespace="urn:myNamespace">
|
||||
<xsd:complexType name="length3">
|
||||
<xsd:all>
|
||||
<xsd:element name="size" type="xsd:nonPositiveInteger"/>
|
||||
<xsd:element name="unit" type="xsd:NMTOKEN"/>
|
||||
</xsd:all>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="complex">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="length" type="tns:length3"/>
|
||||
<xsd:element name="int" type="xsd:int"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="mixed" mixed="true">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="length" type="tns:length3"/>
|
||||
<xsd:element name="int" type="xsd:int"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
|
||||
<xsd:element name="TestElement" type="xsd:int"/>
|
||||
<xsd:element name="TestElementComplexType" type="tns:length3"/>
|
||||
<xsd:simpleType name="testSimpleType1">
|
||||
<xsd:restriction base="int">
|
||||
<xsd:enumeration value="1"/>
|
||||
<xsd:enumeration value="2"/>
|
||||
<xsd:enumeration value="3"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
|
||||
<xsd:simpleType name="testSimpleList">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
SimpleType Test
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:list itemType="int">
|
||||
</xsd:list>
|
||||
</xsd:simpleType>
|
||||
<xsd:simpleType name="testSimpleUnion">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
SimpleType Union test
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:union memberTypes="int float">
|
||||
</xsd:union>
|
||||
</xsd:simpleType>
|
||||
</xsd:schema>
|
||||
</types>
|
||||
<message name="testRequest">
|
||||
<part name="test" type="tns:complex"/>
|
||||
</message>
|
||||
<message name="testResponse">
|
||||
<part name="test" type="tns:testSimpleType1"/>
|
||||
</message>
|
||||
<message name="testRequest2">
|
||||
<part name="test" type="tns:testSimpleType1"/>
|
||||
</message>
|
||||
<message name="testResponse2">
|
||||
<part name="test" type="tns:testSimpleType1"/>
|
||||
</message>
|
||||
<portType name="testPort">
|
||||
<operation name="test">
|
||||
<documentation>
|
||||
Test-Methode
|
||||
</documentation>
|
||||
|
||||
<input message="tns:testRequest"/>
|
||||
<output message="tns:testResponse"/>
|
||||
</operation>
|
||||
<operation name="test2">
|
||||
<documentation>
|
||||
Test-Methode
|
||||
</documentation>
|
||||
|
||||
<input message="tns:testRequest2"/>
|
||||
<output message="tns:testResponse2"/>
|
||||
</operation>
|
||||
</portType>
|
||||
<portType name="testPort2">
|
||||
<operation name="test">
|
||||
<documentation>
|
||||
Test-Methode
|
||||
</documentation>
|
||||
|
||||
<input message="tns:testRequest"/>
|
||||
<output message="tns:testResponse"/>
|
||||
</operation>
|
||||
</portType>
|
||||
<portType name="testPort3">
|
||||
<operation name="test">
|
||||
<documentation>
|
||||
Test-Methode
|
||||
</documentation>
|
||||
<input message="tns:testRequest"/>
|
||||
<output message="tns:testResponse"/>
|
||||
</operation>
|
||||
</portType>
|
||||
|
||||
<binding type="tns:testPort" name="testBinding">
|
||||
<operation name="test">
|
||||
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
|
||||
<soap:operation soapAction="test"/>
|
||||
<input>
|
||||
<soap:body use="literal"/>
|
||||
</input>
|
||||
<output>
|
||||
<soap:body use="literal"/>
|
||||
</output>
|
||||
</operation>
|
||||
</binding>
|
||||
<binding type="tns:testPort2" name="testBinding2">
|
||||
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
|
||||
<operation name="test">
|
||||
<soap:operation soapAction="test"/>
|
||||
<input>
|
||||
<soap:body use="literal"/>
|
||||
</input>
|
||||
<output>
|
||||
<soap:body use="literal"/>
|
||||
</output>
|
||||
</operation>
|
||||
</binding>
|
||||
<binding type="tns:testPort3" name="testBinding3">
|
||||
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
|
||||
<operation name="test">
|
||||
<soap:operation soapAction="test"/>
|
||||
<input>
|
||||
<soap:body use="literal"/>
|
||||
</input>
|
||||
<output>
|
||||
<soap:body use="literal"/>
|
||||
</output>
|
||||
</operation>
|
||||
</binding>
|
||||
<service name="testService">
|
||||
<port name="testPort" binding="tns:testBinding">
|
||||
<soap:address location="http://127.0.0.1/testPort" />
|
||||
</port>
|
||||
<port name="testPort2" binding="tns:testBinding2">
|
||||
<soap:address location="http://127.0.0.1/testPort2" />
|
||||
</port>
|
||||
</service>
|
||||
<service name="testService2">
|
||||
<port name="testPort3" binding="tns:testBinding3">
|
||||
<soap:address location="http://127.0.0.1/testPort3" />
|
||||
</port>
|
||||
|
||||
</service>
|
||||
</definitions>
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
use Test::More tests => 11;
|
||||
use lib '../lib';
|
||||
use File::Basename qw(dirname);
|
||||
use Cwd;
|
||||
|
||||
my $path = dirname __FILE__;
|
||||
|
||||
use_ok(qw/SOAP::WSDL::Expat::WSDLParser/);
|
||||
|
||||
my $filter;
|
||||
|
||||
my $parser;
|
||||
|
||||
ok($parser = SOAP::WSDL::Expat::WSDLParser->new() );
|
||||
|
||||
eval { $parser->parse_file( "$path/test.wsdl" ) };
|
||||
if ($@)
|
||||
{
|
||||
fail("parsing WSDL: $@");
|
||||
die "Can't test without parsed WSDL";
|
||||
}
|
||||
else
|
||||
{
|
||||
pass("parsing XML");
|
||||
}
|
||||
|
||||
my $wsdl;
|
||||
ok( $wsdl = $parser->get_data() , "get object tree");
|
||||
|
||||
my $schema = $wsdl->first_types();
|
||||
|
||||
my $opt = {
|
||||
readable => 0,
|
||||
autotype => 1,
|
||||
namespace => $wsdl->get_xmlns(),
|
||||
indent => "\t",
|
||||
typelib => $schema,
|
||||
};
|
||||
|
||||
is( $schema->find_type( 'urn:myNamespace', 'testSimpleType1' )->serialize(
|
||||
'test', 1 , $opt ),
|
||||
q{<test type="tns:testSimpleType1">1</test>} , "serialize simple type");
|
||||
|
||||
is( $schema->find_type( 'urn:myNamespace', 'testSimpleList' )->serialize(
|
||||
'testList', [ 1, 2, 3 ] , $opt),
|
||||
q{<testList type="tns:testSimpleList">1 2 3</testList>},
|
||||
"serialize simple list type"
|
||||
);
|
||||
|
||||
is( $schema->find_element( 'urn:myNamespace', 'TestElement' )->serialize(
|
||||
undef, 1 , $opt),
|
||||
q{<TestElement type="xsd:int">1</TestElement>}, "Serialize element"
|
||||
);
|
||||
|
||||
$opt->{ readable } = 0;
|
||||
|
||||
is( $schema->find_type( 'urn:myNamespace', 'length3')->serialize(
|
||||
'TestComplex', { size => -13, unit => 'BLA' } ,
|
||||
$opt ),
|
||||
q{<TestComplex type="tns:length3" >}
|
||||
. q{<size type="xsd:nonPositiveInteger">-13</size>}
|
||||
. q{<unit type="xsd:NMTOKEN">BLA</unit></TestComplex>}
|
||||
, "serialize complex type" );
|
||||
|
||||
is( $schema->find_element( 'urn:myNamespace', 'TestElementComplexType')->serialize(
|
||||
undef, { size => -13, unit => 'BLA' } ,
|
||||
$opt ),
|
||||
q{<TestElementComplexType type="tns:length3" >}
|
||||
. q{<size type="xsd:nonPositiveInteger">-13</size>}
|
||||
. q{<unit type="xsd:NMTOKEN">BLA</unit></TestElementComplexType>},
|
||||
"element with complex type"
|
||||
);
|
||||
|
||||
is( $schema->find_type( 'urn:myNamespace', 'complex')->serialize(
|
||||
'complexComplex',
|
||||
{ 'length' => { size => -13, unit => 'BLA' }, 'int' => 1 },
|
||||
$opt ),
|
||||
q{<complexComplex type="tns:complex" >}
|
||||
. q{<length type="tns:length3" >}
|
||||
. q{<size type="xsd:nonPositiveInteger">-13</size>}
|
||||
. q{<unit type="xsd:NMTOKEN">BLA</unit></length>}
|
||||
. q{<int type="xsd:int">1</int></complexComplex>},
|
||||
"nested complex type"
|
||||
);
|
||||
|
||||
is( $wsdl->find_message('urn:myNamespace', 'testRequest')->first_part()->serialize(
|
||||
undef, { test => { length => { size => -13, unit => 'BLA' } , int => 3 } },
|
||||
$opt ),
|
||||
q{<test type="tns:complex" >}
|
||||
. q{<length type="tns:length3" >}
|
||||
. q{<size type="xsd:nonPositiveInteger">-13</size>}
|
||||
. q{<unit type="xsd:NMTOKEN">BLA</unit>}
|
||||
. q{</length><int type="xsd:int">3</int></test>}
|
||||
, "Message part"
|
||||
);
|
||||
|
||||
@@ -1,398 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 5;
|
||||
use lib '../lib';
|
||||
|
||||
eval {
|
||||
require Test::XML;
|
||||
import Test::XML;
|
||||
};
|
||||
|
||||
use_ok(qw/SOAP::WSDL::Expat::WSDLParser/);
|
||||
|
||||
my $parser;
|
||||
|
||||
ok($parser = SOAP::WSDL::Expat::WSDLParser->new(), "Object creation");
|
||||
|
||||
eval { $parser->parse_string( xml() ) };
|
||||
if ($@)
|
||||
{
|
||||
fail("parsing WSDL");
|
||||
die "Can't test without parsed WSDL: $@";
|
||||
}
|
||||
else
|
||||
{
|
||||
pass("parsing XML");
|
||||
}
|
||||
|
||||
my $wsdl;
|
||||
ok( $wsdl = $parser->get_data() , "get object tree");
|
||||
|
||||
my $schema = $wsdl->get_types()->[0]->get_schema()->[0] || die "No schema !";
|
||||
|
||||
my $opt = {
|
||||
typelib => $wsdl->first_types,
|
||||
readable => 1,
|
||||
autotype => 0,
|
||||
namespace => { 'tns' => 'http://www.example.org/MessageGateway2/',
|
||||
'xsd' => 'http://www.w3.org/2001/XMLSchema',
|
||||
'wsdl' => 'http://schemas.xmlsoap.org/wsdl/',
|
||||
},
|
||||
indent => "",
|
||||
};
|
||||
|
||||
my $data = { EnqueueMessage => {
|
||||
MMessage => {
|
||||
MRecipientURI => 'anyURI',
|
||||
MSenderAddress => 'a string',
|
||||
MMessageContent => 'a string',
|
||||
MSubject => 'a string',
|
||||
MDeliveryReportRecipientURI => 'anyURI',
|
||||
MKeepalive => {
|
||||
MKeepaliveTimeout => 1234567,
|
||||
MKeepaliveErrorPolicy => ' ( suppress | report ) ',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
SKIP: { skip_without_test_xml();
|
||||
is_xml( $wsdl->find_message(
|
||||
"http://www.example.org/MessageGateway2/" ,'EnqueueMessageRequest'
|
||||
)->first_part()->serialize( 'test', $data, $opt ),
|
||||
xml_message()
|
||||
, "Serialized message part"
|
||||
);
|
||||
}
|
||||
|
||||
sub skip_without_test_xml {
|
||||
skip("Test::XML not available", 1) if (not $Test::XML::VERSION);
|
||||
}
|
||||
|
||||
sub xml_message {
|
||||
return
|
||||
q{<EnqueueMessage xmlns="http://www.example.org/MessageGateway2/">
|
||||
<MMessage>
|
||||
<MRecipientURI>anyURI</MRecipientURI>
|
||||
<MSenderAddress>a string</MSenderAddress>
|
||||
<MMessageContent>a string</MMessageContent>
|
||||
<MSubject>a string</MSubject>
|
||||
<MDeliveryReportRecipientURI>anyURI</MDeliveryReportRecipientURI>
|
||||
<MKeepalive>
|
||||
<MKeepaliveTimeout>1234567</MKeepaliveTimeout>
|
||||
<MKeepaliveErrorPolicy> ( suppress | report ) </MKeepaliveErrorPolicy>
|
||||
</MKeepalive>
|
||||
</MMessage>
|
||||
</EnqueueMessage>
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
sub xml {
|
||||
return q{<?xml version="1.0" encoding="UTF-8"?>
|
||||
<wsdl:definitions name="MessageGateway"
|
||||
targetNamespace="http://www.example.org/MessageGateway2/"
|
||||
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
|
||||
xmlns:tns="http://www.example.org/MessageGateway2/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||
<wsdl:types>
|
||||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="http://www.example.org/MessageGateway2/">
|
||||
|
||||
<xsd:element name="EnqueueMessage" type="tns:TEnqueueMessage"
|
||||
xmlns:tns="http://www.example.org/MessageGateway2/">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Enqueue message request element</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:complexType name="TMessage">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
A type containing all elements of a message to enqueue.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="MRecipientURI" type="xsd:anyURI" minOccurs="1"
|
||||
maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
|
||||
<xsd:documentation>
|
||||
The recipient in URI notaitions. Valid URI schemas are: mailto:, sms:,
|
||||
phone:. Not all URI schemas need to be implemented at the current
|
||||
implementation stage.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="MSenderAddress" type="xsd:string" minOccurs="0"
|
||||
maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
E-Mail sender address. Ignored for all but mailto: recipient URIs.
|
||||
</xsd:documentation>
|
||||
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="MMessageContent" type="xsd:string" minOccurs="1"
|
||||
maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Message Content.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="MSubject" type="xsd:string" minOccurs="0" maxOccurs="1">
|
||||
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Message Subject. Ignored for all but mailto: URIs
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="MDeliveryReportRecipientURI" type="xsd:anyURI" minOccurs="0"
|
||||
maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
|
||||
URI to send a delivery report to. May be of one of the following schemes:
|
||||
mailto:, http:, https:. Reports to mailto: URIs are sent as plaintext,
|
||||
reports to http(s) URIs are sent as SOAP requests following the
|
||||
MessageGatewayClient service definition.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="MKeepalive" type="tns:TKeepalive" minOccurs="0"
|
||||
maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Container for keepalive information. May be missing.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="TKeepalive">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Type containing keeplive information.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
|
||||
<xsd:element name="MKeepaliveTimeout" type="xsd:double">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Keepalive timeout. The keepalive timeout spezifies how long the sending of
|
||||
a message will be delayed waiting for keepalive updates. If a keepalive
|
||||
update is received during this period, the timeout will be reset. If not,
|
||||
the message will be sent after the timeout has expired.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="MKeepaliveErrorPolicy" minOccurs="0" maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
|
||||
<xsd:documentation>
|
||||
Policy to comply to in case of system errors. Valid values are "suppress"
|
||||
and "report". If the policy is set to "suppress", keepalive messages will
|
||||
not be sent to their recipients in case of partial system failure, even if
|
||||
the keepalive has expired. This may result in "false negatives", i.e.
|
||||
messages may not be sent, even though their keepalive has expired. If the
|
||||
value is "report", keepalive messages will be sent from any cluster node.
|
||||
This may result in "false positive" alerts.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="suppress"></xsd:enumeration>
|
||||
<xsd:enumeration value="report"></xsd:enumeration>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="TMessageID">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Type containing a message ID.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:sequence>
|
||||
<xsd:element name="MMessageID" type="xsd:string" minOccurs="1" maxOccurs="1"></xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="TKeepliveMessage">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Type containing all elements of a keppalive update / remove request.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="MMessageID" type="xsd:string" minOccurs="1" maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
The ID for the message to update / remove
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="MAction" minOccurs="1" maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
The action to perform. Valid values are: "remove", "update". On "remove",
|
||||
the message with the ID specified will be removed from the queue, thus it
|
||||
will never be sent, even if it's timeout expires. On "update" the
|
||||
keepalive timeout of the corresponding message will be reset.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="remove"></xsd:enumeration>
|
||||
<xsd:enumeration value="update"></xsd:enumeration>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:element name="KeepaliveMessage" type="tns:TKeepaliveMessageRequest">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Keepalive message request element</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="KeepaliveMessageResponse" type="tns:TMessageID">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Response element for a keepalive request</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="EnqueueMessageResponse" type="tns:TMessageID">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Enqueue message response element</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
|
||||
|
||||
<xsd:complexType name="TEnqueueMessage">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
A complex type containing one element: The message to enqueue.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="MMessage" type="tns:TMessage">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Element containing a message to enqueue.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
|
||||
<xsd:complexType name="TKeepaliveMessageRequest">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
A complex type containing one element: The keepalive message to process.
|
||||
</xsd:documentation>
|
||||
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="MKeepaliveMessage" type="tns:TKeepliveMessage">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Element containing a keepalive message to process.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:schema>
|
||||
</wsdl:types>
|
||||
<wsdl:message name="EnqueueMessageRequest">
|
||||
<wsdl:part name="parameters" element="tns:EnqueueMessage">
|
||||
<wsdl:documentation>inputparameters for EnqueueMessag</wsdl:documentation>
|
||||
</wsdl:part>
|
||||
|
||||
</wsdl:message>
|
||||
<wsdl:message name="EnqueueMessageResponse">
|
||||
<wsdl:part name="parameters" element="tns:EnqueueMessageResponse">
|
||||
<wsdl:documentation>outputparameters for EnqueueMessag</wsdl:documentation>
|
||||
</wsdl:part>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="KeepaliveMessageRequest">
|
||||
<wsdl:part name="parameters" element="tns:KeepaliveMessage">
|
||||
|
||||
<wsdl:documentation>input parameters for KeepaliveMessag</wsdl:documentation>
|
||||
</wsdl:part>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="KeepaliveMessageResponse">
|
||||
<wsdl:part name="parameters" element="tns:KeepaliveMessageResponse">
|
||||
<wsdl:documentation>output parameters for KeepaliveMessag</wsdl:documentation>
|
||||
</wsdl:part>
|
||||
</wsdl:message>
|
||||
|
||||
<wsdl:portType name="MGWPortType">
|
||||
<wsdl:documentation>
|
||||
generic port type for all methods required for sending messages over the mosaic
|
||||
message gatewa
|
||||
</wsdl:documentation>
|
||||
<wsdl:operation name="EnqueueMessage">
|
||||
<wsdl:documentation>
|
||||
This method is used to enqueue a normal (immediate send) or a delayed message with
|
||||
keepalive functionality.
|
||||
</wsdl:documentation>
|
||||
<wsdl:input message="tns:EnqueueMessageRequest"></wsdl:input>
|
||||
<wsdl:output message="tns:EnqueueMessageResponse"></wsdl:output>
|
||||
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="KeepaliveMessage">
|
||||
<wsdl:documentation>
|
||||
This method is used to update or remove a
|
||||
keepalive message.
|
||||
</wsdl:documentation>
|
||||
<wsdl:input message="tns:KeepaliveMessageRequest"></wsdl:input>
|
||||
<wsdl:output message="tns:KeepaliveMessageResponse"></wsdl:output>
|
||||
</wsdl:operation>
|
||||
</wsdl:portType>
|
||||
|
||||
<wsdl:binding name="MGWBinding" type="tns:MGWPortType">
|
||||
<wsdl:documentation>Generic binding for all (SOAP) port</wsdl:documentation>
|
||||
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
|
||||
<wsdl:operation name="EnqueueMessage">
|
||||
<soap:operation soapAction="http://www.example.org/MessageGateway2/EnqueueMessage" />
|
||||
<wsdl:input>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="KeepaliveMessage">
|
||||
<soap:operation
|
||||
soapAction="http://www.example.org/MessageGateway2/KeepaliveMessage" />
|
||||
<wsdl:input>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:input>
|
||||
|
||||
<wsdl:output>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
</wsdl:binding>
|
||||
<wsdl:service name="MessageGateway">
|
||||
<wsdl:documentation>
|
||||
Web Service for sending messages over the mosaic message gatewa
|
||||
</wsdl:documentation>
|
||||
|
||||
<wsdl:port name="HTTPPort" binding="tns:MGWBinding">
|
||||
<wsdl:documentation>HTTP(S) port for the mosaic message gatewa</wsdl:documentation>
|
||||
<soap:address location="https://www.example.org/MessageGateway/" />
|
||||
</wsdl:port>
|
||||
</wsdl:service>
|
||||
</wsdl:definitions>};
|
||||
}
|
||||
116
t/006_client.t
116
t/006_client.t
@@ -1,116 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
use strict;
|
||||
use warnings;
|
||||
use diagnostics;
|
||||
use Test::More tests => 17; # qw/no_plan/; # TODO: change to tests => N;
|
||||
use lib '../lib';
|
||||
|
||||
eval {
|
||||
require Test::XML;
|
||||
import Test::XML
|
||||
};
|
||||
|
||||
use Cwd;
|
||||
|
||||
my $path = cwd;
|
||||
$path =~s|\/t\/?$||; # allow running from t/ and above (Build test)
|
||||
|
||||
use_ok(qw/SOAP::WSDL/);
|
||||
|
||||
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
|
||||
)->wsdlinit();
|
||||
|
||||
$soap->servicename('MessageGateway');
|
||||
|
||||
ok( $soap->no_dispatch( 1 ) , "Set no_dispatch" );
|
||||
ok $soap->get_client();
|
||||
ok ! $soap->get_client()->get_proxy();
|
||||
|
||||
SKIP: {
|
||||
skip_without_test_xml();
|
||||
is_xml( $soap->call( 'EnqueueMessage' , EnqueueMessage => {
|
||||
'MMessage' => {
|
||||
'MRecipientURI' => 'mailto:test@example.com' ,
|
||||
'MMessageContent' => 'TestContent for Message' ,
|
||||
}
|
||||
}
|
||||
)
|
||||
, q{<SOAP-ENV:Envelope
|
||||
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" >
|
||||
<SOAP-ENV:Body ><EnqueueMessage xmlns="http://www.example.org/MessageGateway2/"><MMessage>
|
||||
<MRecipientURI>mailto:test@example.com</MRecipientURI>
|
||||
<MMessageContent>TestContent for Message</MMessageContent>
|
||||
</MMessage></EnqueueMessage></SOAP-ENV:Body></SOAP-ENV:Envelope>}
|
||||
, "content comparison with optional elements");
|
||||
}
|
||||
|
||||
sub skip_without_test_xml {
|
||||
my $number = shift || 1;
|
||||
skip("Test::XML not available", $number) if (not $Test::XML::VERSION);
|
||||
}
|
||||
|
||||
# test whether call sets proxy
|
||||
$soap->call( 'EnqueueMessage' , EnqueueMessage => {
|
||||
'MMessage' => {
|
||||
'MRecipientURI' => 'mailto:test@example.com' ,
|
||||
'MMessageContent' => 'TestContent for Message' ,
|
||||
}
|
||||
}
|
||||
);
|
||||
ok $soap->get_client()->get_proxy();
|
||||
ok $soap->get_client()->get_transport();
|
||||
|
||||
# serializer & deserializer must be set after call()
|
||||
ok $soap->get_client()->get_serializer();
|
||||
# ok $soap->get_client()->get_deserializer(); # no deserializer with outputxml
|
||||
|
||||
# set_soap_version invalidates serializer and deserializer
|
||||
ok $soap->get_client()->set_soap_version('1.1');
|
||||
ok ! $soap->get_client()->get_serializer();
|
||||
|
||||
$soap->call( 'EnqueueMessage' , EnqueueMessage => {
|
||||
'MMessage' => {
|
||||
'MRecipientURI' => 'mailto:test@example.com' ,
|
||||
'MMessageContent' => 'TestContent for Message' ,
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
# serializer & deserializer come back after call()
|
||||
ok $soap->get_client()->get_serializer();
|
||||
# ok $soap->get_client()->get_deserializer(); # no deserializer with outputxml
|
||||
|
||||
|
||||
SKIP: {
|
||||
eval "require SOAP::Lite"
|
||||
or skip 'cannot test SOAP::Deserializer::SOM without SOAP::Lite', 4;
|
||||
require SOAP::WSDL::Transport::Loopback;
|
||||
$soap->outputxml(0);
|
||||
$soap->no_dispatch(0);
|
||||
ok my $result = $soap->call( 'EnqueueMessage' , EnqueueMessage => {
|
||||
'MMessage' => {
|
||||
'MRecipientURI' => 'mailto:test@example.com' ,
|
||||
'MMessageContent' => 'TestContent for Message' ,
|
||||
}
|
||||
}
|
||||
);
|
||||
ok $result->isa('SOAP::SOM');
|
||||
is $result->result()->{MMessageContent}, 'TestContent for Message';
|
||||
is $result->result()->{MRecipientURI}, 'mailto:test@example.com';
|
||||
};
|
||||
|
||||
use_ok 'SOAP::WSDL::Client';
|
||||
my $client = SOAP::WSDL::Client->new();
|
||||
eval {
|
||||
$client->set_proxy([ 'http://example.org', keep_alive => 1 ]);
|
||||
$client->set_proxy('http://example.org', keep_alive => 1 );
|
||||
};
|
||||
if (! $@) {
|
||||
pass 'set_proxy';
|
||||
}
|
||||
else {
|
||||
fail $@
|
||||
};
|
||||
@@ -1,36 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Test::More qw/no_plan/;
|
||||
use lib '../lib';
|
||||
|
||||
eval {
|
||||
require Test::XML;
|
||||
import Test::XML;
|
||||
};
|
||||
|
||||
use_ok qw/SOAP::WSDL::Serializer::XSD/;
|
||||
|
||||
my $opt = {
|
||||
readable => 1,
|
||||
namespace => {
|
||||
},
|
||||
};
|
||||
my $xml;
|
||||
ok( $xml = SOAP::WSDL::Serializer::XSD->serialize(
|
||||
undef, undef, $opt
|
||||
),
|
||||
"serialize empty envelope"
|
||||
);
|
||||
|
||||
SKIP: {
|
||||
skip 'Cannot test XML content without Test::XML', 1
|
||||
if (not $Test::XML::VERSION);
|
||||
is_xml( $xml, q{<SOAP-ENV:Envelope
|
||||
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" >
|
||||
<SOAP-ENV:Body >
|
||||
</SOAP-ENV:Body>
|
||||
</SOAP-ENV:Envelope>}
|
||||
, 'Content comparison' );
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More qw/no_plan/; # TODO: change to tests => N;
|
||||
use lib '../lib';
|
||||
use File::Basename;
|
||||
use File::Spec;
|
||||
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
my ($volume, $dir) = File::Spec->splitpath($path, 1);
|
||||
my @dir_from = File::Spec->splitdir($dir);
|
||||
unshift @dir_from, $volume if $volume;
|
||||
my $url = join '/', @dir_from;
|
||||
|
||||
use_ok(qw/SOAP::WSDL/);
|
||||
|
||||
my $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file://' . $url .'/acceptance/wsdl/008_complexType.wsdl'
|
||||
)->wsdlinit();
|
||||
|
||||
my $wsdl = $soap->get_definitions;
|
||||
my $schema = $wsdl->first_types();
|
||||
my $type = $schema->find_type('Test' , 'testComplexTypeAll');
|
||||
my $element = $type->get_element()->[0];
|
||||
|
||||
is $element->get_minOccurs() , 0, "minOccurs default for all";
|
||||
is $element->get_maxOccurs() , 1, "maxOccurs default for all";
|
||||
|
||||
$type = $schema->find_type('Test' , 'testComplexTypeSequence');
|
||||
$element = $type->get_element()->[0];
|
||||
|
||||
is $element->get_minOccurs() , 1, "minOccurs default for sequence";
|
||||
is $element->get_maxOccurs() , 1, "maxOccurs default for sequence";
|
||||
@@ -1,91 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 5;
|
||||
use lib 't/lib';
|
||||
use lib '../lib';
|
||||
use lib 'lib';
|
||||
|
||||
use SOAP::WSDL::Expat::MessageParser;
|
||||
use Cwd;
|
||||
|
||||
use SOAP::WSDL;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin;
|
||||
use File::Basename;
|
||||
use File::Spec;
|
||||
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
my ($volume, $dir) = File::Spec->splitpath($path, 1);
|
||||
my @dir_from = File::Spec->splitdir($dir);
|
||||
unshift @dir_from, $volume if $volume;
|
||||
my $url = join '/', @dir_from;
|
||||
|
||||
my $parser;
|
||||
|
||||
ok $parser = SOAP::WSDL::Expat::MessageParser->new({
|
||||
class_resolver => FakeResolver->new(),
|
||||
}), "Object creation";
|
||||
ok $parser->class_resolver()->isa('FakeResolver');
|
||||
ok $parser->class_resolver('FakeResolver');
|
||||
|
||||
# TODO factor out into bool test
|
||||
|
||||
$parser->parse( xml() );
|
||||
|
||||
if($parser->get_data()->get_MMessage()->get_MDeliveryReportRecipientURI()) {
|
||||
pass "bool context overloading";
|
||||
}
|
||||
else
|
||||
{
|
||||
fail "bool context overloading"
|
||||
}
|
||||
|
||||
# TODO factor out into different test
|
||||
|
||||
my $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file://' . $url .'/acceptance/wsdl/006_sax_client.wsdl',
|
||||
)->wsdlinit();
|
||||
|
||||
$soap->servicename('MessageGateway');
|
||||
|
||||
ok( $soap->no_dispatch( 1 ) , "Set no_dispatch" );
|
||||
|
||||
sub xml {
|
||||
q{<SOAP-ENV:Envelope
|
||||
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
|
||||
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
|
||||
xmlns:tns="http://www.example.org/MessageGateway2/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" >
|
||||
<SOAP-ENV:Body ><EnqueueMessage><MMessage>
|
||||
<MRecipientURI>mailto:test@example.com</MRecipientURI>
|
||||
<MMessageContent>TestContent for Message</MMessageContent>
|
||||
<MMessageContent>TestContent for Message 2</MMessageContent>
|
||||
<MSenderAddress>martin.kutter@example.com</MSenderAddress>
|
||||
<MDeliveryReportRecipientURI>mailto:test@example.com</MDeliveryReportRecipientURI>
|
||||
</MMessage></EnqueueMessage></SOAP-ENV:Body></SOAP-ENV:Envelope>};
|
||||
}
|
||||
|
||||
# data classes reside in t/lib/Typelib/
|
||||
BEGIN {
|
||||
package FakeResolver;
|
||||
{
|
||||
my %class_list = (
|
||||
'EnqueueMessage' => 'Typelib::TEnqueueMessage',
|
||||
'EnqueueMessage/MMessage' => 'Typelib::TMessage',
|
||||
'EnqueueMessage/MMessage/MRecipientURI' => 'SOAP::WSDL::XSD::Typelib::Builtin::anyURI',
|
||||
'EnqueueMessage/MMessage/MMessageContent' => 'SOAP::WSDL::XSD::Typelib::Builtin::string',
|
||||
'EnqueueMessage/MMessage/MSenderAddress' => 'SOAP::WSDL::XSD::Typelib::Builtin::string',
|
||||
'EnqueueMessage/MMessage/MMessageContent' => 'SOAP::WSDL::XSD::Typelib::Builtin::string',
|
||||
'EnqueueMessage/MMessage/MDeliveryReportRecipientURI' => 'SOAP::WSDL::XSD::Typelib::Builtin::anyURI',
|
||||
);
|
||||
|
||||
sub new { return bless {}, 'FakeResolver' };
|
||||
sub get_typemap { return \%class_list };
|
||||
sub get_class {
|
||||
my $name = join('/', @{ $_[1] });
|
||||
return ($class_list{ $name }) ? $class_list{ $name }
|
||||
: warn "no class found for $name";
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -1,36 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
use Test::More qw(no_plan);
|
||||
use strict;
|
||||
use lib 'lib/';
|
||||
use lib 't/lib/';
|
||||
use lib '../lib/';
|
||||
|
||||
use_ok qw(MySimpleType);
|
||||
|
||||
# simple type derived from builtin via restriction
|
||||
my $obj = MySimpleType->new({ value => 'test'});
|
||||
ok $obj->isa('SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType')
|
||||
, 'inherited class';
|
||||
is $obj, 'test', 'stringification';
|
||||
|
||||
# simple type derived from builtin via list
|
||||
$obj = MySimpleListType->new({ value => [ 'test', 'test2' ]});
|
||||
ok $obj->isa('SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType')
|
||||
, 'inherited class';
|
||||
ok $obj->isa('SOAP::WSDL::XSD::Typelib::Builtin::list')
|
||||
, 'inherited class';
|
||||
is $obj->serialize(), 'test test2', 'stringification';
|
||||
|
||||
# simple type derived from atomic simple type (restriction)
|
||||
$obj = MyAtomicSimpleType->new({ value => 'test' });
|
||||
ok $obj->isa('MySimpleType') , 'inherited class';
|
||||
ok $obj->isa('SOAP::WSDL::XSD::Typelib::SimpleType::restriction')
|
||||
, 'inherited class';
|
||||
is $obj, 'test', 'stringification';
|
||||
|
||||
# simple type derived from atomic simple type (list)
|
||||
$obj = MyAtomicSimpleListType->new({ value => [ 'test', 'test2' ] });
|
||||
ok $obj->isa('MySimpleListType') , 'inherited class';
|
||||
ok $obj->isa('SOAP::WSDL::XSD::Typelib::SimpleType::restriction')
|
||||
, 'inherited class';
|
||||
is $obj->serialize(), 'test test2', 'stringification';
|
||||
@@ -1,68 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
use Test::More qw(no_plan);
|
||||
use strict;
|
||||
use lib 'lib/';
|
||||
use lib '../lib/';
|
||||
use lib 't/lib';
|
||||
|
||||
use_ok qw(SOAP::WSDL::XSD::Typelib::Element);
|
||||
use_ok qw( MyElement );
|
||||
|
||||
# simple type derived from builtin via restriction
|
||||
my $obj = MyElement->new({ value => 'test'});
|
||||
ok $obj->isa('SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType')
|
||||
, 'inherited class';
|
||||
is $obj->serialize_qualified(), '<MyElementName xmlns="urn:Test" >test</MyElementName>', 'stringification';
|
||||
|
||||
$obj = MyAtomicComplexTypeElement->new({ test=> 'Test', test2 => 'Test2'});
|
||||
ok $obj->isa('SOAP::WSDL::XSD::Typelib::Builtin::anyType')
|
||||
, 'inherited class';
|
||||
|
||||
ok $obj->get_test->isa('SOAP::WSDL::XSD::Typelib::Builtin::string')
|
||||
, 'element isa';
|
||||
|
||||
is $obj->serialize_qualified, '<MyAtomicComplexTypeElement xmlns="urn:Test" ><test >Test</test>'
|
||||
. '<test2 >Test2</test2></MyAtomicComplexTypeElement>'
|
||||
, 'stringification';
|
||||
|
||||
$obj = MyElement->new({ value => undef});
|
||||
ok $obj->isa('SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType')
|
||||
, 'inherited class';
|
||||
|
||||
# is $obj, '<MyElementName xmlns="urn:Test" xsi:nil="true" />', 'nillable stringification';
|
||||
|
||||
$obj = MyAtomicComplexTypeElement->new({ test=> 'Test', test2 => [ 'Test2', 'Test3' ]});
|
||||
ok $obj->isa('SOAP::WSDL::XSD::Typelib::Builtin::anyType')
|
||||
, 'inherited class';
|
||||
is $obj, '<MyAtomicComplexTypeElement xmlns="urn:Test" ><test >Test</test>'
|
||||
. '<test2 >Test2</test2>'
|
||||
. '<test2 >Test3</test2>'
|
||||
. '</MyAtomicComplexTypeElement>'
|
||||
, 'multi value stringification';
|
||||
|
||||
ok $obj = MyComplexTypeElement->new({ MyTestName => 'test' });
|
||||
is $obj->serialize_qualified(), '<MyComplexTypeElement xmlns="urn:Test" ><MyTestName >test</MyTestName ></MyComplexTypeElement>';
|
||||
|
||||
__END__
|
||||
|
||||
# simple type derived from builtin via list
|
||||
$obj = MySimpleListType->new({ value => [ 'test', 'test2' ]});
|
||||
ok $obj->isa('SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType')
|
||||
, 'inherited class';
|
||||
ok $obj->isa('SOAP::WSDL::XSD::Typelib::Builtin::list')
|
||||
, 'inherited class';
|
||||
is $obj, 'test test2', 'stringification';
|
||||
|
||||
# simple type derived from atomic simple type (restriction)
|
||||
$obj = MyAtomicSimpleType->new({ value => 'test' });
|
||||
ok $obj->isa('MySimpleType') , 'inherited class';
|
||||
ok $obj->isa('SOAP::WSDL::XSD::Typelib::SimpleType::restriction')
|
||||
, 'inherited class';
|
||||
is $obj, 'test', 'stringification';
|
||||
|
||||
# simple type derived from atomic simple type (list)
|
||||
$obj = MyAtomicSimpleListType->new({ value => [ 'test', 'test2' ] });
|
||||
ok $obj->isa('MySimpleListType') , 'inherited class';
|
||||
ok $obj->isa('SOAP::WSDL::XSD::Typelib::SimpleType::restriction')
|
||||
, 'inherited class';
|
||||
is $obj, 'test test2', 'stringification';
|
||||
@@ -1,48 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
use Test::More qw(no_plan);
|
||||
use strict;
|
||||
use lib 'lib/';
|
||||
use lib '../lib/';
|
||||
use lib 't/lib';
|
||||
use Storable;
|
||||
|
||||
use_ok qw(SOAP::WSDL::XSD::Typelib::ComplexType);
|
||||
use_ok qw( MyComplexType );
|
||||
# simple type derived from builtin via restriction
|
||||
my $obj = MyComplexType->new({ MyTestName => 'test' });
|
||||
ok $obj->isa('SOAP::WSDL::XSD::Typelib::Builtin::anyType')
|
||||
, 'inherited class';
|
||||
is $obj, '<MyTestName >test</MyTestName >', 'stringification';
|
||||
|
||||
$obj = MyComplexType->new({ MyTestName => [ 'test', 'test2' ] });
|
||||
ok $obj->isa('SOAP::WSDL::XSD::Typelib::Builtin::anyType')
|
||||
, 'inherited class';
|
||||
is $obj, '<MyTestName >test</MyTestName ><MyTestName >test2</MyTestName >',
|
||||
'stringification';
|
||||
|
||||
# try on the fly factory
|
||||
@MyComplexType2::ISA = ('SOAP::WSDL::XSD::Typelib::ComplexType');
|
||||
{
|
||||
use Class::Std::Fast::Storable;
|
||||
my %MyTestName_of;
|
||||
|
||||
MyComplexType2->_factory(
|
||||
[ qw(MyTestName) ], # order
|
||||
{ MyTestName => \%MyTestName_of }, # attribute lookup map
|
||||
{ MyTestName => 'MyElement' } # class name lookup map
|
||||
);
|
||||
}
|
||||
|
||||
$obj = MyComplexType2->new({ MyTestName => [ 'test', 'test2' ] });
|
||||
ok $obj->isa('SOAP::WSDL::XSD::Typelib::Builtin::anyType')
|
||||
, 'inherited class (on the fly-factory object)';
|
||||
is $obj, '<MyTestName >test</MyTestName><MyTestName >test2</MyTestName>',
|
||||
'stringification (on the fly-factory object)';
|
||||
|
||||
# TODO factor out into complexType test
|
||||
|
||||
eval { $obj->get_ZUMSL };
|
||||
like $@, qr{Valid\smethods}xm, 'error message (invalid method)';
|
||||
|
||||
__END__
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
use Test::More tests => 9;
|
||||
use strict;
|
||||
use lib 'lib/';
|
||||
use lib '../lib/';
|
||||
use lib 't/lib';
|
||||
|
||||
use_ok qw(SOAP::WSDL::SOAP::Typelib::Fault11);
|
||||
use_ok qw(SOAP::WSDL::XSD::Typelib::Element);
|
||||
use_ok qw( MyElement );
|
||||
use_ok qw( SOAP::WSDL::Client );
|
||||
# simple type derived from builtin via restriction
|
||||
|
||||
my $obj = MyAtomicComplexTypeElement->new({ test=> 'Test', test2 => 'Test2'});
|
||||
ok $obj->isa('SOAP::WSDL::XSD::Typelib::Builtin::anyType')
|
||||
, 'inherited class';
|
||||
|
||||
# print $obj->get_test;
|
||||
|
||||
ok $obj->get_test->isa('SOAP::WSDL::XSD::Typelib::Builtin::string')
|
||||
, 'element isa';
|
||||
|
||||
is $obj, '<MyAtomicComplexTypeElement xmlns="urn:Test" ><test >Test</test>'
|
||||
. '<test2 >Test2</test2></MyAtomicComplexTypeElement>'
|
||||
, 'stringification';
|
||||
|
||||
my $soap = SOAP::WSDL::Client->new( {
|
||||
class_resolver => 'FakeResolver',
|
||||
} )
|
||||
->proxy('http://bla')
|
||||
->no_dispatch(1);
|
||||
|
||||
# TODO: use Test::XML for testing and re-integrate
|
||||
|
||||
# is $soap->call('Test', $obj), q{<SOAP-ENV:Envelope }
|
||||
# . q{xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" }
|
||||
# . q{xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" >}
|
||||
# . q{<SOAP-ENV:Body><MyAtomicComplexTypeElement xmlns="urn:Test" >}
|
||||
# . q{<test >Test</test>}
|
||||
# . q{<test2 >Test2</test2>}
|
||||
# . q{</MyAtomicComplexTypeElement></SOAP-ENV:Body></SOAP-ENV:Envelope>}
|
||||
# , 'SOAP Envelope generation with objects';
|
||||
|
||||
my $result = $soap->proxy('http://bla')
|
||||
->no_dispatch(0)
|
||||
->call('Test', $obj);
|
||||
ok $result->isa('SOAP::WSDL::SOAP::Typelib::Fault11'),
|
||||
'return fault on impossible call';
|
||||
ok ! $result, 'fault is false in boolean context';
|
||||
|
||||
package FakeResolver;
|
||||
|
||||
sub get_class {
|
||||
my %class_list = (
|
||||
'Fault' => 'SOAP::WSDL::SOAP::Typelib::Fault11',
|
||||
'Fault/faultactor' => 'SOAP::WSDL::XSD::Typelib::Builtin::string',
|
||||
'Fault/faultcode' => 'SOAP::WSDL::XSD::Typelib::Builtin::anyURI',
|
||||
'Fault/faultstring' => 'SOAP::WSDL::XSD::Typelib::Builtin::string',
|
||||
'Fault/detail' => 'SOAP::WSDL::XSD::Typelib::Builtin::anyType',
|
||||
);
|
||||
return $class_list{ $_[1] };
|
||||
}
|
||||
|
||||
@@ -1,439 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 22;
|
||||
use lib '../lib';
|
||||
use SOAP::WSDL::Expat::WSDLParser;
|
||||
use SOAP::WSDL::Expat::MessageParser;
|
||||
use File::Path;
|
||||
use File::Basename;
|
||||
use Carp qw(confess);
|
||||
|
||||
use_ok qw(SOAP::WSDL::Generator::Template::XSD);
|
||||
|
||||
my $path = dirname __FILE__;
|
||||
|
||||
my $wsdl;
|
||||
ok( $wsdl = SOAP::WSDL::Expat::WSDLParser->new()
|
||||
->parse_string( xml() ) , "get object tree");
|
||||
|
||||
my $generator = SOAP::WSDL::Generator::Template::XSD->new({
|
||||
definitions => $wsdl,
|
||||
OUTPUT_PATH => "$path/testlib",
|
||||
typemap_prefix => "Test::Typemap",
|
||||
type_prefix => "Test::Type",
|
||||
element_prefix => "Test::Element",
|
||||
interface_prefix => "Test::Interface",
|
||||
});
|
||||
# local $SIG{__WARN__} = sub { confess @_};
|
||||
$generator->generate_interface();
|
||||
$generator->generate_typemap();
|
||||
{
|
||||
local $SIG{__WARN__} = sub {};
|
||||
$generator->generate_typelib();
|
||||
}
|
||||
|
||||
eval "use lib '$path/testlib'";
|
||||
|
||||
use_ok qw(Test::Element::EnqueueMessage);
|
||||
use_ok qw(Test::Type::TMessage);
|
||||
use_ok qw(Test::Typemap::MessageGateway);
|
||||
|
||||
my $data = {
|
||||
MMessage => {
|
||||
MRecipientURI => 'anyURI',
|
||||
MSenderAddress => 'a string',
|
||||
MMessageContent => 'a string',
|
||||
MSubject => 'a string',
|
||||
MDeliveryReportRecipientURI => 'anyURI',
|
||||
MKeepalive => {
|
||||
MKeepaliveTimeout => 1234567,
|
||||
MKeepaliveErrorPolicy => ' ( suppress | report ) ',
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ok Test::Element::EnqueueMessage->new( $data ) , '(generated) object constructor';
|
||||
|
||||
my $message_parser = SOAP::WSDL::Expat::MessageParser->new({
|
||||
class_resolver => 'Test::Typemap::MessageGateway',
|
||||
strict => 0,
|
||||
});
|
||||
my $msg;
|
||||
eval { $msg = $message_parser->parse_string( xml_message2() ) };
|
||||
ok ( !$@, 'parse XML message: ' . $@);
|
||||
|
||||
|
||||
eval { $message_parser->parse_string( xml_message() ) };
|
||||
ok ( !$@, 'parse XML message using atomic type definitions');
|
||||
|
||||
SKIP: {
|
||||
eval "require Test::Pod; ";
|
||||
skip 'Cannot test generated POD without Test::POD' , 12 if $@;
|
||||
|
||||
foreach my $module (Test::Pod::all_pod_files( "$path/testlib")) {
|
||||
Test::Pod::pod_file_ok( $module )
|
||||
}
|
||||
}
|
||||
|
||||
use_ok qw(Test::Interface::MessageGateway::HTTPPort);
|
||||
|
||||
my $interface =
|
||||
Test::Interface::MessageGateway::HTTPPort->new( { no_dispatch => 1, } );
|
||||
|
||||
ok $interface->EnqueueMessage(
|
||||
{
|
||||
MMessage => { #Test::Type::TMessage
|
||||
MRecipientURI => 'mailto:recipient@example.org',
|
||||
MSenderAddress => 'mailto:sender@example.org',
|
||||
MMessageContent => 'content',
|
||||
MSubject => 'subject',
|
||||
MDeliveryReportRecipientURI => 'mailto:report.recipient@example.org',
|
||||
}
|
||||
}),
|
||||
'interface operation call (no_dispatch set)';
|
||||
|
||||
|
||||
# cleanup
|
||||
rmtree "$path/testlib";
|
||||
|
||||
# print $wsdl->explain();
|
||||
|
||||
sub xml_message {
|
||||
return
|
||||
q{<EnqueueMessage xmlns="http://www.example.org/MessageGateway2/">
|
||||
<MMessage>
|
||||
<MRecipientURI>anyURI</MRecipientURI>
|
||||
<MSenderAddress>a string</MSenderAddress>
|
||||
<MMessageContent>a string</MMessageContent>
|
||||
<MSubject>a string</MSubject>
|
||||
<MDeliveryReportRecipientURI>anyURI</MDeliveryReportRecipientURI>
|
||||
<MKeepalive>
|
||||
<MKeepaliveTimeout>1234567</MKeepaliveTimeout>
|
||||
<MKeepaliveErrorPolicy> ( suppress | report ) </MKeepaliveErrorPolicy>
|
||||
</MKeepalive>
|
||||
</MMessage>
|
||||
</EnqueueMessage>
|
||||
};
|
||||
}
|
||||
|
||||
sub xml_message2 {
|
||||
return
|
||||
q{<EnqueueMessage xmlns="http://www.example.org/MessageGateway2/">
|
||||
<MMessage>
|
||||
<MRecipientURI>anyURI</MRecipientURI>
|
||||
<MSenderAddress>a string</MSenderAddress>
|
||||
<MMessageContent>a string</MMessageContent>
|
||||
<MSubject>a string</MSubject>
|
||||
<MDeliveryReportRecipientURI>anyURI</MDeliveryReportRecipientURI>
|
||||
</MMessage>
|
||||
</EnqueueMessage>
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
sub xml {
|
||||
return q{<?xml version="1.0" encoding="UTF-8"?>
|
||||
<wsdl:definitions name="MessageGateway"
|
||||
targetNamespace="http://www.example.org/MessageGateway2/"
|
||||
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
|
||||
xmlns:tns="http://www.example.org/MessageGateway2/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||
<wsdl:types>
|
||||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="http://www.example.org/MessageGateway2/">
|
||||
|
||||
<xsd:element name="EnqueueMessage" type="tns:TEnqueueMessage"
|
||||
xmlns:tns="http://www.example.org/MessageGateway2/">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Enqueue message request element</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:complexType name="TMessage">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
A type containing all elements of a message to enqueue.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="MRecipientURI" type="xsd:anyURI" minOccurs="1"
|
||||
maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
|
||||
<xsd:documentation>
|
||||
The recipient in URI notaitions. Valid URI schemas are: mailto:, sms:,
|
||||
phone:. Not all URI schemas need to be implemented at the current
|
||||
implementation stage.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="MSenderAddress" type="xsd:string" minOccurs="0"
|
||||
maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
E-Mail sender address. Ignored for all but mailto: recipient URIs.
|
||||
</xsd:documentation>
|
||||
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="MMessageContent" type="xsd:string" minOccurs="1"
|
||||
maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Message Content.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="MSubject" type="xsd:string" minOccurs="0" maxOccurs="1">
|
||||
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Message Subject. Ignored for all but mailto: URIs
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="MDeliveryReportRecipientURI" type="xsd:anyURI" minOccurs="0"
|
||||
maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
|
||||
URI to send a delivery report to. May be of one of the following schemes:
|
||||
mailto:, http:, https:. Reports to mailto: URIs are sent as plaintext,
|
||||
reports to http(s) URIs are sent as SOAP requests following the
|
||||
MessageGatewayClient service definition.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="MKeepalive" type="tns:TKeepalive" minOccurs="0"
|
||||
maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Container for keepalive information. May be missing.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="TKeepalive">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Type containing keeplive information.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
|
||||
<xsd:element name="MKeepaliveTimeout" type="xsd:double">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Keepalive timeout. The keepalive timeout spezifies how long the sending of
|
||||
a message will be delayed waiting for keepalive updates. If a keepalive
|
||||
update is received during this period, the timeout will be reset. If not,
|
||||
the message will be sent after the timeout has expired.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="MKeepaliveErrorPolicy" minOccurs="0" maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
|
||||
<xsd:documentation>
|
||||
Policy to comply to in case of system errors. Valid values are "suppress"
|
||||
and "report". If the policy is set to "suppress", keepalive messages will
|
||||
not be sent to their recipients in case of partial system failure, even if
|
||||
the keepalive has expired. This may result in "false negatives", i.e.
|
||||
messages may not be sent, even though their keepalive has expired. If the
|
||||
value is "report", keepalive messages will be sent from any cluster node.
|
||||
This may result in "false positive" alerts.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="suppress"></xsd:enumeration>
|
||||
<xsd:enumeration value="report"></xsd:enumeration>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="TMessageID">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Type containing a message ID.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:sequence>
|
||||
<xsd:element name="MMessageID" type="xsd:string" minOccurs="1" maxOccurs="1"></xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="TKeepliveMessage">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Type containing all elements of a keppalive update / remove request.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="MMessageID" type="xsd:string" minOccurs="1" maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
The ID for the message to update / remove
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="MAction" minOccurs="1" maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
The action to perform. Valid values are: "remove", "update". On "remove",
|
||||
the message with the ID specified will be removed from the queue, thus it
|
||||
will never be sent, even if it's timeout expires. On "update" the
|
||||
keepalive timeout of the corresponding message will be reset.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="remove"></xsd:enumeration>
|
||||
<xsd:enumeration value="update"></xsd:enumeration>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:element name="KeepaliveMessage" type="tns:TKeepaliveMessageRequest">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Keepalive message request element</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="KeepaliveMessageResponse" type="tns:TMessageID">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Response element for a keepalive request</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="EnqueueMessageResponse" type="tns:TMessageID">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Enqueue message response element</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
|
||||
|
||||
<xsd:complexType name="TEnqueueMessage">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
A complex type containing one element: The message to enqueue.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="MMessage" type="tns:TMessage">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Element containing a message to enqueue.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
|
||||
<xsd:complexType name="TKeepaliveMessageRequest">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
A complex type containing one element: The keepalive message to process.
|
||||
</xsd:documentation>
|
||||
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="MKeepaliveMessage" type="tns:TKeepliveMessage">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Element containing a keepalive message to process.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:schema>
|
||||
</wsdl:types>
|
||||
<wsdl:message name="EnqueueMessageRequest">
|
||||
<wsdl:part name="parameters" element="tns:EnqueueMessage">
|
||||
<wsdl:documentation>inputparameters for EnqueueMessag</wsdl:documentation>
|
||||
</wsdl:part>
|
||||
|
||||
</wsdl:message>
|
||||
<wsdl:message name="EnqueueMessageResponse">
|
||||
<wsdl:part name="parameters" element="tns:EnqueueMessageResponse">
|
||||
<wsdl:documentation>outputparameters for EnqueueMessag</wsdl:documentation>
|
||||
</wsdl:part>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="KeepaliveMessageRequest">
|
||||
<wsdl:part name="parameters" element="tns:KeepaliveMessage">
|
||||
|
||||
<wsdl:documentation>input parameters for KeepaliveMessag</wsdl:documentation>
|
||||
</wsdl:part>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="KeepaliveMessageResponse">
|
||||
<wsdl:part name="parameters" element="tns:KeepaliveMessageResponse">
|
||||
<wsdl:documentation>output parameters for KeepaliveMessag</wsdl:documentation>
|
||||
</wsdl:part>
|
||||
</wsdl:message>
|
||||
|
||||
<wsdl:portType name="MGWPortType">
|
||||
<wsdl:documentation>
|
||||
generic port type for all methods required for sending messages over the mosaic
|
||||
message gatewa
|
||||
</wsdl:documentation>
|
||||
<wsdl:operation name="EnqueueMessage">
|
||||
<wsdl:documentation>
|
||||
This method is used to enqueue a normal (immediate send) or a delayed message with
|
||||
keepalive functionality.
|
||||
</wsdl:documentation>
|
||||
<wsdl:input message="tns:EnqueueMessageRequest"></wsdl:input>
|
||||
<wsdl:output message="tns:EnqueueMessageResponse"></wsdl:output>
|
||||
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="KeepaliveMessage">
|
||||
<wsdl:documentation>
|
||||
This method is used to update or remove a
|
||||
keepalive message.
|
||||
</wsdl:documentation>
|
||||
<wsdl:input message="tns:KeepaliveMessageRequest"></wsdl:input>
|
||||
<wsdl:output message="tns:KeepaliveMessageResponse"></wsdl:output>
|
||||
</wsdl:operation>
|
||||
</wsdl:portType>
|
||||
|
||||
<wsdl:binding name="MGWBinding" type="tns:MGWPortType">
|
||||
<wsdl:documentation>Generic binding for all (SOAP) port</wsdl:documentation>
|
||||
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
|
||||
<wsdl:operation name="EnqueueMessage">
|
||||
<soap:operation soapAction="http://www.example.org/MessageGateway2/EnqueueMessage" />
|
||||
<wsdl:input>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="KeepaliveMessage">
|
||||
<soap:operation
|
||||
soapAction="http://www.example.org/MessageGateway2/KeepaliveMessage" />
|
||||
<wsdl:input>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:input>
|
||||
|
||||
<wsdl:output>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
</wsdl:binding>
|
||||
<wsdl:service name="MessageGateway">
|
||||
<wsdl:documentation>
|
||||
Web Service for sending messages over the message gatewa
|
||||
</wsdl:documentation>
|
||||
|
||||
<wsdl:port name="HTTPPort" binding="tns:MGWBinding">
|
||||
<wsdl:documentation>HTTP(S) port for the message gateway</wsdl:documentation>
|
||||
<soap:address location="https://www.example.org/MessageGateway/" />
|
||||
</wsdl:port>
|
||||
</wsdl:service>
|
||||
</wsdl:definitions>};
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
use Test::More tests => 1;
|
||||
use lib '../lib';
|
||||
eval "require SOAP::WSDL::XSD::Typelib::Builtin";
|
||||
use Storable;
|
||||
|
||||
my $long = SOAP::WSDL::XSD::Typelib::Builtin::long->new();
|
||||
$long->set_value( 9 );
|
||||
my $clone = Storable::thaw( Storable::freeze( $long ) );
|
||||
|
||||
is $clone->serialize, 9 , 'clone via freeze/thaw';
|
||||
@@ -1,77 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Test::More;
|
||||
use English qw(-no_match_vars);
|
||||
use File::Find;
|
||||
use IO::File;
|
||||
|
||||
|
||||
if ( not $ENV{TEST_AUTHOR} ) {
|
||||
my $msg = 'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.';
|
||||
plan( skip_all => $msg );
|
||||
}
|
||||
|
||||
my @skip = (
|
||||
qr(\.svn)
|
||||
);
|
||||
|
||||
my $dir = 'blib/lib';
|
||||
if (-d '../t') {
|
||||
$dir = '../lib';
|
||||
}
|
||||
|
||||
my @filelist = ();
|
||||
find( \&filelist, $dir);
|
||||
|
||||
sub filelist {
|
||||
my $name = $_;
|
||||
return if (-d $name);
|
||||
return if $File::Find::name =~m{\.svn}x;
|
||||
push @filelist, $File::Find::name;
|
||||
}
|
||||
|
||||
plan tests => scalar @filelist;
|
||||
|
||||
for my $file (sort @filelist) {
|
||||
check_file($file);
|
||||
}
|
||||
|
||||
sub check_file {
|
||||
my $file = shift;
|
||||
my $fh = IO::File->new($file, O_RDONLY) or die "Cannot open $file";
|
||||
my $line_nr = 0;
|
||||
my $error_count = 0;
|
||||
|
||||
while (my $line = $fh->getline() ) {
|
||||
# check for trailing whitespace
|
||||
# allow single whitespace on line to allow
|
||||
# pod source blocks with empty lines
|
||||
#
|
||||
$line_nr++;
|
||||
if ($line =~m{ (:?[^\s]+|\s)\s\r?\n$ }x) {
|
||||
$error_count++;
|
||||
print "# trailing whitespace in $file line $line_nr at end of line\n"
|
||||
}
|
||||
|
||||
# check for tabs and report their position
|
||||
my @tab_pos_from = ();
|
||||
my $pos = -1;
|
||||
while (1) {
|
||||
$pos = index($line, "\t", $pos + 1);
|
||||
last if $pos <0;
|
||||
push @tab_pos_from, $pos + 1;
|
||||
}
|
||||
if (@tab_pos_from) {
|
||||
print "# tab found in $file line $line_nr cols ${ \join(', ', @tab_pos_from) }\n";
|
||||
$error_count += scalar(@tab_pos_from);
|
||||
}
|
||||
|
||||
if ($line=~m{\r}) {
|
||||
print "# CR (\\r) found in $file line $line_nr. Convert to LF only.\n";
|
||||
$error_count++;
|
||||
}
|
||||
}
|
||||
is $error_count, 0 , "$file characters";
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Test::More;
|
||||
use English qw(-no_match_vars);
|
||||
|
||||
if ( not $ENV{TEST_AUTHOR} ) {
|
||||
my $msg = 'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.';
|
||||
plan( skip_all => $msg );
|
||||
}
|
||||
|
||||
chdir '..' if -d ('../t');
|
||||
|
||||
eval 'use Test::Kwalitee';
|
||||
|
||||
if ( $EVAL_ERROR ) {
|
||||
my $msg = 'Test::Kwalitee not installed; skipping';
|
||||
plan( skip_all => $msg );
|
||||
}
|
||||
19
t/098_pod.t
19
t/098_pod.t
@@ -1,19 +0,0 @@
|
||||
use Test::More;
|
||||
eval "use Test::Pod 1.00";
|
||||
plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
|
||||
|
||||
# perl Build test or make test run from top-level dir.
|
||||
if ( -d '../t/' ) {
|
||||
@directories = ('../lib/');
|
||||
}
|
||||
else {
|
||||
@directories = (); # empty - will work automatically
|
||||
}
|
||||
|
||||
my @files = all_pod_files(@directories);
|
||||
|
||||
plan tests => scalar(@files);
|
||||
|
||||
foreach my $module (@files){
|
||||
pod_file_ok( $module )
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
use Test::More;
|
||||
|
||||
|
||||
if ( not $ENV{TEST_AUTHOR} ) {
|
||||
my $msg = 'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.';
|
||||
plan( skip_all => $msg );
|
||||
}
|
||||
|
||||
eval "use Test::Pod::Coverage 1.00";
|
||||
plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD" if $@;
|
||||
|
||||
my @dirs = ( 'lib' );
|
||||
if (-d '../t/') { # we are inside t/
|
||||
@dirs = ('../lib');
|
||||
}
|
||||
else { # we are outside t/
|
||||
# add ./lib to include path if blib/lib is not there (e.g. we're not
|
||||
# run from Build test or the like)
|
||||
push @INC, './lib' if not grep { $_ eq 'blib/lib' } @INC;
|
||||
}
|
||||
|
||||
# Don't test Builtin XSD types - they're undocumented on purpose
|
||||
# Don't test WSDL datatypes - they're undocumented on purpose.
|
||||
@files = grep { $_ !~m{ (SOAP::WSDL::XSD::Typelib::Builtin::.+
|
||||
|SOAP::WSDL::OpMessage
|
||||
|SOAP::WSDL::Types
|
||||
|SOAP::WSDL::PortType
|
||||
|SOAP::WSDL::Port
|
||||
|SOAP::WSDL::Service
|
||||
|SOAP::WSDL::Binding
|
||||
|SOAP::WSDL::Message
|
||||
|SOAP::WSDL::TypeLookup
|
||||
|SOAP::WSDL::Base
|
||||
|SOAP::WSDL::Part
|
||||
|SOAP::WSDL::Operation
|
||||
|SOAP::WSDL::SOAP::[^:]+
|
||||
|SOAP::WSDL::XSD::SimpleType
|
||||
|SOAP::WSDL::XSD::Element
|
||||
|SOAP::WSDL::XSD::ComplexType
|
||||
|SOAP::WSDL::XSD::Builtin
|
||||
|SOAP::WSDL::XSD::Schema
|
||||
|
||||
) \z }xms; } all_modules( @dirs );
|
||||
|
||||
plan tests => scalar @files;
|
||||
foreach (@files) {
|
||||
pod_coverage_ok( $_ ,
|
||||
{
|
||||
private => [
|
||||
qr/^_/,
|
||||
qr/^BUILD$/,
|
||||
qr/^START$/,
|
||||
qr/^STORABLE/,
|
||||
qr/^AUTOMETHOD$/,
|
||||
qr/^DEMOLISH$/
|
||||
]
|
||||
});
|
||||
}
|
||||
107
t/1_performance.t
Normal file
107
t/1_performance.t
Normal file
@@ -0,0 +1,107 @@
|
||||
#!/usr/bin/perl -w
|
||||
use strict;
|
||||
use Test;
|
||||
plan tests=> 11;
|
||||
use Time::HiRes qw( gettimeofday tv_interval );
|
||||
use lib '../lib';
|
||||
use Data::Dumper;
|
||||
use Cwd;
|
||||
|
||||
use SOAP::WSDL;
|
||||
|
||||
ok 1; # if we made it this far, we're ok
|
||||
### test vars END
|
||||
|
||||
print "# Testing SOAP::WSDL ". $SOAP::WSDL::VERSION."\n";
|
||||
print "# Performance test with WSDL file\n";
|
||||
|
||||
my $data = { name => 'Mein Name',
|
||||
givenName => 'Vorname' };
|
||||
|
||||
my $dir = cwd;
|
||||
|
||||
# chomp /t/ to allow running the script from t/ directory
|
||||
$dir=~s|/t/?$||;
|
||||
|
||||
my $t0 = [gettimeofday];
|
||||
|
||||
{
|
||||
ok( my $soap=SOAP::WSDL->new(
|
||||
wsdl => "file://$dir/t/acceptance/helloworld.asmx.xml",
|
||||
no_dispatch => 1
|
||||
) );
|
||||
|
||||
print "# Test with NO caching\n";
|
||||
print "# Create SOAP::WSDL object (".tv_interval ( $t0, [gettimeofday]) ."ms)\n" ;
|
||||
|
||||
|
||||
$t0 = [gettimeofday];
|
||||
eval{ $soap->wsdlinit(caching => 0) };
|
||||
unless ($@) {
|
||||
ok(1);
|
||||
} else {
|
||||
ok 0;
|
||||
print STDERR $@;
|
||||
}
|
||||
print "# wsdl file init (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;;
|
||||
|
||||
$soap->readable(1);
|
||||
$soap->wsdl_cache_store();
|
||||
$soap->servicename("Service1");
|
||||
$soap->portname("Service1Soap");
|
||||
|
||||
$t0 = [gettimeofday];
|
||||
ok( $soap->call("sayHello" , %{ $data }));
|
||||
print "# NO cache first call: (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
|
||||
|
||||
$t0 = [gettimeofday];
|
||||
ok($soap->call(sayHello => %{ $data }) );
|
||||
print "# NO cache second call (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
|
||||
|
||||
$t0 = [gettimeofday];
|
||||
for (1..10) {
|
||||
$soap->call(sayHello => %{ $data });
|
||||
}
|
||||
ok(1);
|
||||
print "# NO cache: 10 x call (".tv_interval ( $t0, [gettimeofday]) ."s)\n";
|
||||
}
|
||||
{
|
||||
print "# Test with caching ENABLED\n";
|
||||
|
||||
$t0 = [gettimeofday];
|
||||
ok(my $soap=SOAP::WSDL->new(
|
||||
wsdl => "file://$dir/t/acceptance/helloworld.asmx.xml",
|
||||
no_dispatch => 1
|
||||
) );
|
||||
print "# Create SOAP::WSDL object (".tv_interval ( $t0, [gettimeofday]) ."ms)\n" ;
|
||||
-e "$dir/t/cache" or mkdir "$dir/t/cache";
|
||||
|
||||
$t0 = [gettimeofday];
|
||||
eval{ $soap->wsdlinit(caching => 1,cache_directory =>"$dir/t/cache") };
|
||||
unless ($@) {
|
||||
ok(1);
|
||||
} else {
|
||||
ok 0;
|
||||
print STDERR $@;
|
||||
}
|
||||
print "# wsdl file init (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;;
|
||||
$soap->readable(1);
|
||||
$soap->servicename("Service1");
|
||||
$soap->portname("Service1Soap");
|
||||
|
||||
$t0 = [gettimeofday];
|
||||
ok( $soap->call("sayHello" , %{ $data }));
|
||||
print "# CACHE first call (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
|
||||
|
||||
$t0 = [gettimeofday];
|
||||
ok($soap->call(sayHello => %{ $data }) );
|
||||
print "# CACHE second call: (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
|
||||
|
||||
$t0 = [gettimeofday];
|
||||
for (1..10) {
|
||||
$soap->call(sayHello => %{ $data });
|
||||
}
|
||||
ok(1);
|
||||
print "# CACHE: 10 x call (".tv_interval ( $t0, [gettimeofday]) ."s)\n";
|
||||
|
||||
}
|
||||
104
t/2_helloworld.NET.t
Normal file
104
t/2_helloworld.NET.t
Normal file
@@ -0,0 +1,104 @@
|
||||
#!/usr/bin/perl -w
|
||||
#######################################################################################
|
||||
#
|
||||
# 2_helloworld.t
|
||||
#
|
||||
# Acceptance test for message encoding, based on .NET wsdl and example code.
|
||||
# SOAP::WSDL's encoding doesn't I<exactly> match the .NET example, because
|
||||
# .NET doesn't always specify types (SOAP::WSDL does), and the namespace
|
||||
# prefixes chosen are different (maybe the encoding style, too ? this would be a bug !)
|
||||
#
|
||||
########################################################################################
|
||||
|
||||
use strict;
|
||||
use diagnostics;
|
||||
use Test;
|
||||
plan tests => 5;
|
||||
use Time::HiRes qw( gettimeofday tv_interval );
|
||||
use lib '../lib';
|
||||
use Cwd;
|
||||
use SOAP::WSDL;
|
||||
ok 1; # if we made it this far, we're ok
|
||||
### test vars END
|
||||
print "# Testing SOAP::WSDL ". $SOAP::WSDL::VERSION."\n";
|
||||
print "# Acceptance test against sample output with simple WSDL\n";
|
||||
|
||||
my $data = {
|
||||
name => 'test',
|
||||
givenName => 'GIVENNAME',
|
||||
test => {
|
||||
name => 'TESTNAME',
|
||||
givenName => 'GIVENNAME',
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
my $dir= cwd;
|
||||
$dir=~s/\/t\/?$//;
|
||||
|
||||
my $t0 = [gettimeofday];
|
||||
ok( my $soap=SOAP::WSDL->new(wsdl => 'file:///'.$dir.'/t/acceptance/test.wsdl.xml',
|
||||
no_dispatch => 1 ) );
|
||||
|
||||
print "# Create SOAP::WSDL object (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
|
||||
|
||||
$t0 = [gettimeofday];
|
||||
eval{ $soap->wsdlinit() };
|
||||
unless ($@) {
|
||||
ok(1);
|
||||
} else {
|
||||
ok 0;
|
||||
print STDERR $@;
|
||||
}
|
||||
|
||||
print "# WSDL init (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
|
||||
$soap->servicename("Service1");
|
||||
$soap->portname("Service1Soap");
|
||||
|
||||
$t0 = [gettimeofday];
|
||||
do {
|
||||
my $xml = $soap->serializer->method( $soap->call(sayHello => %{ $data }) );
|
||||
|
||||
open (FILE, "acceptance/helloworld.xml")
|
||||
|| open (FILE, "t/acceptance/helloworld.xml") || die "can't open acceptance file";
|
||||
my $xml_test=<FILE>;
|
||||
close FILE;
|
||||
$xml=~s/^.+\<([^\/]+?)\:Body\>//;
|
||||
$xml=~s/\<\/$1\:Body\>.*//;
|
||||
|
||||
$xml_test=~s/^.+\<([^\/]+?)\:Body\>//;
|
||||
$xml_test=~s/\<\/$1\:Body\>.*//;
|
||||
|
||||
if ( ($xml) && ($xml eq $xml_test) ) {
|
||||
ok 1;
|
||||
print "# Message encoding (" .tv_interval ( $t0, [gettimeofday]) ."s)\n"
|
||||
} else {
|
||||
ok 0;
|
||||
print "# Message encoding (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
|
||||
print "$xml\n$xml_test\n"; };
|
||||
};
|
||||
|
||||
$t0 = [gettimeofday];
|
||||
do {
|
||||
my $xml = $soap->serializer->method( $soap->call(sayHello => %{ $data }) );
|
||||
|
||||
open (FILE, "acceptance/helloworld.xml")
|
||||
|| open FILE, ("t/acceptance/helloworld.xml") || die "can't open acceptance file";
|
||||
my $xml_test=<FILE>;
|
||||
close FILE;
|
||||
$xml=~s/^.+\<([^\/]+?)\:Body\>//;
|
||||
$xml=~s/\<\/$1\:Body\>.*//;
|
||||
|
||||
$xml_test=~s/^.+\<([^\/]+?)\:Body\>//;
|
||||
$xml_test=~s/\<\/$1\:Body\>.*//;
|
||||
|
||||
if ( ($xml) && ($xml eq $xml_test) ) {
|
||||
ok 1;
|
||||
print "# Message encoding (" .tv_interval ( $t0, [gettimeofday]) ."s)\n";
|
||||
} else {
|
||||
ok 0;
|
||||
print "# Message encoding (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
|
||||
print "$xml\n$xml_test\n";
|
||||
};
|
||||
};
|
||||
|
||||
109
t/3_various.t
Normal file
109
t/3_various.t
Normal file
@@ -0,0 +1,109 @@
|
||||
#!/usr/bin/perl -w
|
||||
use strict;
|
||||
use warnings;
|
||||
use diagnostics;
|
||||
use Test::More tests=> 9;
|
||||
use Time::HiRes qw( gettimeofday tv_interval );
|
||||
use lib '../lib';
|
||||
use Data::Dumper;
|
||||
use Cwd;
|
||||
use_ok qw/SOAP::WSDL/;
|
||||
|
||||
print "# Testing SOAP::WSDL ". $SOAP::WSDL::VERSION."\n";
|
||||
print "# Various Features Test with WSDL file \n";
|
||||
|
||||
my $data = {name => 'Mein Name',
|
||||
givenName => 'Vorname'};
|
||||
|
||||
my $dir = cwd;
|
||||
|
||||
# chomp /t/ to allow running the script from t/ directory
|
||||
$dir=~s|/t/?$||;
|
||||
|
||||
my $t0 = [gettimeofday];
|
||||
ok( my $soap=SOAP::WSDL->new(wsdl => "file://$dir/t/acceptance/helloworld.asmx.xml",
|
||||
no_dispatch => 1
|
||||
));
|
||||
|
||||
print "# Create SOAP::WSDL object (".tv_interval ( $t0, [gettimeofday]) ."ms)\n" ;
|
||||
|
||||
$t0 = [gettimeofday];
|
||||
eval{ $soap->wsdlinit(caching => 0) };
|
||||
if ($@) {
|
||||
fail("wsdlinit");
|
||||
print STDERR $@;
|
||||
} else {
|
||||
pass("wsdlinit");
|
||||
}
|
||||
print "# wsdl file init (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;;
|
||||
|
||||
$soap->readable(1);
|
||||
$soap->servicename("Service1");
|
||||
$soap->portname("Service1Soap");
|
||||
|
||||
$t0 = [gettimeofday];
|
||||
ok( $soap->call("sayHello" , %{ $data }), "call sayHello");
|
||||
print "# Normal Call: (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
|
||||
|
||||
$soap->servicename("Service2");
|
||||
is( $soap->portname("Service2Soap"), 'Service2Soap' );
|
||||
|
||||
$data = {name => 'Mein Name',
|
||||
givenName => 'Vorname'};
|
||||
|
||||
$t0 = [gettimeofday];
|
||||
ok($soap->call(sayGoodBye => %{ $data }), "Multiple Services/Port Call" );
|
||||
print "# Multiple Services/Port Call: (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
|
||||
|
||||
$soap->servicename("Service2");
|
||||
$soap->portname("Service2Soap");
|
||||
$data = {name => 'Mein Name',
|
||||
givenName => 'Vorname',
|
||||
wsdl_input_name => 'firstOverload'
|
||||
};
|
||||
|
||||
$t0 = [gettimeofday];
|
||||
|
||||
my $xml = $soap->serializer->method( $soap->call(sayGoodByeOverload => %{ $data }) );
|
||||
like($xml , qr/<name/, 'serialized overloaded method');
|
||||
|
||||
$data = {
|
||||
name => 'Mein Name',
|
||||
givenName => 'Vorname',
|
||||
wsdl_input_name => 'secondOverload'
|
||||
};
|
||||
|
||||
$t0 = [gettimeofday];
|
||||
$xml = $soap->serializer->method( $soap->call(sayGoodByeOverload => %{ $data }) );
|
||||
unlike($xml , qr/<name/ , 'Overloaded calls');
|
||||
|
||||
print "# Overloaded Calls: (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
|
||||
|
||||
$soap->servicename("Service2");
|
||||
$soap->portname("Service2Soap");
|
||||
$data = { name => 'Mein Name',
|
||||
'recipients' => [
|
||||
{user_name => 'Adam', last_name => "Eden"},
|
||||
{user_name => 'Eve',last_name => 'Apple'},
|
||||
],
|
||||
wsdl_input_name => 'thirdOverload'
|
||||
};
|
||||
|
||||
$t0 = [gettimeofday];
|
||||
$xml = $soap->serializer->method( $soap->call(sayGoodByeOverload => %{ $data }) );
|
||||
|
||||
my $xpath = new XML::XPath->new(xml=>$xml);
|
||||
|
||||
my @recipients = $xpath->findnodes('//recipients');
|
||||
if($recipients[0]->findvalue("user_name") eq "Adam" and
|
||||
$recipients[0]->findvalue("last_name") eq "Eden" and
|
||||
$recipients[1]->findvalue("user_name") eq "Eve" and
|
||||
$recipients[1]->findvalue("last_name") eq "Apple"){
|
||||
ok(1);
|
||||
}else{
|
||||
ok(0);
|
||||
}
|
||||
print "# Restricted Arrays: (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
|
||||
print "#End\n";
|
||||
|
||||
|
||||
55
t/4_auto_set_port.t
Normal file
55
t/4_auto_set_port.t
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/perl -w
|
||||
#######################################################################################
|
||||
#
|
||||
# 2_helloworld.t
|
||||
#
|
||||
# Acceptance test for message encoding, based on .NET wsdl and example code.
|
||||
# SOAP::WSDL's encoding doesn't I<exactly> match the .NET example, because
|
||||
# .NET doesn't always specify types (SOAP::WSDL does), and the namespace
|
||||
# prefixes chosen are different (maybe the encoding style, too ? this would be a bug !)
|
||||
#
|
||||
########################################################################################
|
||||
|
||||
use strict;
|
||||
use diagnostics;
|
||||
use Test::More tests => 6;
|
||||
use Time::HiRes qw( gettimeofday tv_interval );
|
||||
use lib '../lib';
|
||||
use Cwd;
|
||||
use_ok qw/SOAP::WSDL/;
|
||||
|
||||
### test vars END
|
||||
print "# Testing SOAP::WSDL ". $SOAP::WSDL::VERSION."\n";
|
||||
print "# Acceptance test against sample output with simple WSDL\n";
|
||||
|
||||
my $data = {
|
||||
name => 'test',
|
||||
givenName => 'GIVENNAME',
|
||||
test => {
|
||||
name => 'TESTNAME',
|
||||
givenName => 'GIVENNAME',
|
||||
},
|
||||
};
|
||||
|
||||
my $dir= cwd;
|
||||
$dir=~s/\/t\/?$//;
|
||||
|
||||
# print $dir;
|
||||
my $url = $dir . '/t/acceptance/test.wsdl.xml';
|
||||
die "no wsdl found" if (not -e $url);
|
||||
ok( my $soap=SOAP::WSDL->new( wsdl => 'file:///'. $url ), "Create SOAP::WSDL object");
|
||||
$soap->no_dispatch( 1 );
|
||||
|
||||
eval{ $soap->wsdlinit() };
|
||||
unless ($@) {
|
||||
pass "wsdlinit";
|
||||
} else {
|
||||
fail "wsdlinit - $@";
|
||||
}
|
||||
|
||||
|
||||
ok( $soap->call(sayHello => %{ $data }) , "SOAP call");
|
||||
|
||||
is( $soap->servicename() , 'Service1', "Auto-detected servicename");
|
||||
is( $soap->portname() , 'Service1Soap', "Auto-detected portname");
|
||||
|
||||
19
t/5_same_transport.t
Normal file
19
t/5_same_transport.t
Normal file
@@ -0,0 +1,19 @@
|
||||
# Addresses issue reported by David Bussenschutt
|
||||
use Test::More tests => 1;
|
||||
use lib '../lib';
|
||||
use SOAP::Lite;
|
||||
use SOAP::WSDL;
|
||||
use File::Spec;
|
||||
use File::Basename qw(dirname);
|
||||
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__);
|
||||
|
||||
my $soap = SOAP::WSDL->new(
|
||||
wsdl => "file://$path/acceptance/helloworld.asmx.xml"
|
||||
);
|
||||
my $transport = $soap->schema()->useragent()->protocols_forbidden(['file']);
|
||||
|
||||
# If it dies with 500 Access to 'file'..., wsdlinit uses the same UA...
|
||||
eval { $soap->wsdlinit()};
|
||||
ok index( $@, q{500 Access to 'file}) > 0;
|
||||
|
||||
27
t/97_pod.t
Normal file
27
t/97_pod.t
Normal file
@@ -0,0 +1,27 @@
|
||||
use Test::More;
|
||||
eval "use Test::Pod 1.00";
|
||||
plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
|
||||
|
||||
use Cwd;
|
||||
|
||||
my $dir = cwd;
|
||||
|
||||
if ( $dir =~ /t$/ )
|
||||
{
|
||||
@directories = ('../lib/');
|
||||
}
|
||||
else
|
||||
{
|
||||
@directories = ();
|
||||
}
|
||||
|
||||
my @files = all_pod_files(
|
||||
@directories
|
||||
);
|
||||
|
||||
plan tests => scalar(@files);
|
||||
|
||||
foreach my $module (@files)
|
||||
{
|
||||
pod_file_ok( $module )
|
||||
}
|
||||
27
t/98_pod_coverage.t
Normal file
27
t/98_pod_coverage.t
Normal file
@@ -0,0 +1,27 @@
|
||||
use Test::More;
|
||||
eval { use Test::Pod::Coverage 1.08 };
|
||||
plan skip_all => "Test::Pod::Coverage 1.08 required for testing POD" if $@;
|
||||
|
||||
|
||||
BEGIN
|
||||
{
|
||||
if (-d 't/') # we're not in the test dir - probably using
|
||||
{ # Build test
|
||||
@dirs = ('blib/lib')
|
||||
}
|
||||
else
|
||||
{
|
||||
@dirs = '../lib';
|
||||
use lib '../lib'; # use our lib if we are in t/ (if we are, we're)
|
||||
# not run from "make test" / "Build test"
|
||||
}
|
||||
}
|
||||
|
||||
@files = all_modules( @dirs );
|
||||
plan tests => scalar @files;
|
||||
foreach (@files)
|
||||
{
|
||||
s/^\.\.::blib::lib:://;
|
||||
s/^\.\.::lib:://;
|
||||
pod_coverage_ok( $_ );
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 2;
|
||||
use lib '../lib';
|
||||
use lib 'lib';
|
||||
use lib 't/lib';
|
||||
|
||||
use_ok(qw/SOAP::WSDL::Expat::MessageParser/);
|
||||
|
||||
use MyComplexType;
|
||||
use MyElement;
|
||||
use MySimpleType;
|
||||
|
||||
my $xml = q{<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" >
|
||||
<SOAP-ENV:Body><MyAtomicComplexTypeElement xmlns="urn:Test" >
|
||||
<test>Test</test>
|
||||
<test2 >Test2</test2>
|
||||
<foo><bar></bar><baz></baz></foo>
|
||||
</MyAtomicComplexTypeElement></SOAP-ENV:Body></SOAP-ENV:Envelope>};
|
||||
|
||||
my $parser = SOAP::WSDL::Expat::MessageParser->new({
|
||||
class_resolver => 'FakeResolver'
|
||||
});
|
||||
|
||||
$parser->parse( $xml );
|
||||
|
||||
is $parser->get_data(), q{<MyAtomicComplexTypeElement xmlns="urn:Test" >}
|
||||
. q{<test >Test</test><test2 >Test2</test2></MyAtomicComplexTypeElement>}
|
||||
, 'Content comparison';
|
||||
|
||||
# data classes reside in t/lib/Typelib/
|
||||
BEGIN {
|
||||
package FakeResolver;
|
||||
{
|
||||
my %class_list = (
|
||||
'MyAtomicComplexTypeElement' => 'MyAtomicComplexTypeElement',
|
||||
'MyAtomicComplexTypeElement/test' => 'MyTestElement',
|
||||
'MyAtomicComplexTypeElement/test2' => 'MyTestElement2',
|
||||
'MyAtomicComplexTypeElement/foo' => '__SKIP__',
|
||||
# 'MyAtomicComplexTypeElement/foo/bar' => 'MyFooElement',
|
||||
# 'MyAtomicComplexTypeElement/foo/baz' => 'MyFooElement',
|
||||
);
|
||||
|
||||
sub new { return bless {}, 'FakeResolver' };
|
||||
|
||||
sub get_typemap { return \%class_list };
|
||||
|
||||
sub get_class {
|
||||
my $name = join('/', @{ $_[1] });
|
||||
return ($class_list{ $name }) ? $class_list{ $name }
|
||||
: warn "no class found for $name";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
@@ -1,410 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
use strict;
|
||||
use warnings;
|
||||
use diagnostics;
|
||||
use Test::More tests => 7;
|
||||
use lib '../lib';
|
||||
|
||||
eval {
|
||||
require Test::XML;
|
||||
import Test::XML;
|
||||
};
|
||||
|
||||
use_ok(qw/SOAP::WSDL::Expat::WSDLParser/);
|
||||
|
||||
my $parser;
|
||||
ok $parser = SOAP::WSDL::Expat::WSDLParser->new(), "Object creation";
|
||||
|
||||
$parser->parse( xml() );
|
||||
|
||||
eval { $parser->parse( xml() ) };
|
||||
if ($@)
|
||||
{
|
||||
fail("parsing WSDL");
|
||||
die "Can't test without parsed WSDL: " , Dumper $@;
|
||||
}
|
||||
else
|
||||
{
|
||||
pass("parsing XML");
|
||||
}
|
||||
|
||||
my $wsdl;
|
||||
ok $wsdl = $parser->get_data() , "get object tree";
|
||||
|
||||
my $schema = $wsdl->first_types()->get_schema()->[1] || die "No schema !";
|
||||
|
||||
my $element = $schema->find_element(
|
||||
'http://www.example.org/MessageGateway2/'
|
||||
, 'EnqueueMessage'
|
||||
);
|
||||
|
||||
ok $element, 'find element';
|
||||
is $element->get_xmlns()->{ 'tns' }, 'http://www.example.org/MessageGateway2/', 'Namespace definition';
|
||||
|
||||
|
||||
my $opt = {
|
||||
typelib => $wsdl->first_types,
|
||||
readable => 1,
|
||||
autotype => 0,
|
||||
namespace => { 'tns' => 'http://www.example.org/MessageGateway2/',
|
||||
xsd => 'http://www.w3.org/2001/XMLSchema',
|
||||
'wsdl' => 'http://schemas.xmlsoap.org/wsdl/',
|
||||
},
|
||||
indent => "",
|
||||
};
|
||||
|
||||
my $data = { EnqueueMessage => {
|
||||
MMessage => {
|
||||
MRecipientURI => 'anyURI',
|
||||
MSenderAddress => 'a string',
|
||||
MMessageContent => 'a string',
|
||||
MSubject => 'a string',
|
||||
MDeliveryReportRecipientURI => 'anyURI',
|
||||
MKeepalive => {
|
||||
MKeepaliveTimeout => 1234567,
|
||||
MKeepaliveErrorPolicy => ' ( suppress | report ) ',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
SKIP: { skip_without_test_xml();
|
||||
is_xml( $wsdl->find_message(
|
||||
"http://www.example.org/MessageGateway2/" ,'EnqueueMessageRequest'
|
||||
)->first_part()->serialize( 'test', $data, $opt ),
|
||||
xml_message()
|
||||
, "Serialized message part"
|
||||
);
|
||||
}
|
||||
|
||||
sub skip_without_test_xml {
|
||||
skip("Test::XML not available", 1) if (not $Test::XML::VERSION);
|
||||
}
|
||||
|
||||
sub xml_message {
|
||||
return
|
||||
q{<EnqueueMessage xmlns="http://www.example.org/MessageGateway2/">
|
||||
<MMessage>
|
||||
<MRecipientURI>anyURI</MRecipientURI>
|
||||
<MSenderAddress>a string</MSenderAddress>
|
||||
<MMessageContent>a string</MMessageContent>
|
||||
<MSubject>a string</MSubject>
|
||||
<MDeliveryReportRecipientURI>anyURI</MDeliveryReportRecipientURI>
|
||||
<MKeepalive>
|
||||
<MKeepaliveTimeout>1234567</MKeepaliveTimeout>
|
||||
<MKeepaliveErrorPolicy> ( suppress | report ) </MKeepaliveErrorPolicy>
|
||||
</MKeepalive>
|
||||
</MMessage>
|
||||
</EnqueueMessage>
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
sub xml {
|
||||
return q{<?xml version="1.0" encoding="UTF-8"?>
|
||||
<wsdl:definitions name="MessageGateway"
|
||||
targetNamespace="http://www.example.org/MessageGateway2/"
|
||||
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
|
||||
xmlns:tns="http://www.example.org/MessageGateway2/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||
<wsdl:types>
|
||||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="http://www.example.org/MessageGateway2/">
|
||||
|
||||
<xsd:element name="EnqueueMessage" type="tns:TEnqueueMessage"
|
||||
xmlns:tns="http://www.example.org/MessageGateway2/"
|
||||
>
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Enqueue message request element</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:complexType name="TMessage">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
A type containing all elements of a message to enqueue.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="MRecipientURI" type="xsd:anyURI" minOccurs="1"
|
||||
maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
|
||||
<xsd:documentation>
|
||||
The recipient in URI notaitions. Valid URI schemas are: mailto:, sms:,
|
||||
phone:. Not all URI schemas need to be implemented at the current
|
||||
implementation stage.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="MSenderAddress" type="xsd:string" minOccurs="0"
|
||||
maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
E-Mail sender address. Ignored for all but mailto: recipient URIs.
|
||||
</xsd:documentation>
|
||||
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="MMessageContent" type="xsd:string" minOccurs="1"
|
||||
maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Message Content.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="MSubject" type="xsd:string" minOccurs="0" maxOccurs="1">
|
||||
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Message Subject. Ignored for all but mailto: URIs
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="MDeliveryReportRecipientURI" type="xsd:anyURI" minOccurs="0"
|
||||
maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
|
||||
URI to send a delivery report to. May be of one of the following schemes:
|
||||
mailto:, http:, https:. Reports to mailto: URIs are sent as plaintext,
|
||||
reports to http(s) URIs are sent as SOAP requests following the
|
||||
MessageGatewayClient service definition.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="MKeepalive" type="tns:TKeepalive" minOccurs="0"
|
||||
maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Container for keepalive information. May be missing.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="TKeepalive">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Type containing keeplive information.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
|
||||
<xsd:element name="MKeepaliveTimeout" type="xsd:double">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Keepalive timeout. The keepalive timeout spezifies how long the sending of
|
||||
a message will be delayed waiting for keepalive updates. If a keepalive
|
||||
update is received during this period, the timeout will be reset. If not,
|
||||
the message will be sent after the timeout has expired.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="MKeepaliveErrorPolicy" minOccurs="0" maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
|
||||
<xsd:documentation>
|
||||
Policy to comply to in case of system errors. Valid values are "suppress"
|
||||
and "report". If the policy is set to "suppress", keepalive messages will
|
||||
not be sent to their recipients in case of partial system failure, even if
|
||||
the keepalive has expired. This may result in "false negatives", i.e.
|
||||
messages may not be sent, even though their keepalive has expired. If the
|
||||
value is "report", keepalive messages will be sent from any cluster node.
|
||||
This may result in "false positive" alerts.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="suppress"></xsd:enumeration>
|
||||
<xsd:enumeration value="report"></xsd:enumeration>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="TMessageID">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Type containing a message ID.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:sequence>
|
||||
<xsd:element name="MMessageID" type="xsd:string" minOccurs="1" maxOccurs="1"></xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="TKeepliveMessage">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Type containing all elements of a keppalive update / remove request.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="MMessageID" type="xsd:string" minOccurs="1" maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
The ID for the message to update / remove
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="MAction" minOccurs="1" maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
The action to perform. Valid values are: "remove", "update". On "remove",
|
||||
the message with the ID specified will be removed from the queue, thus it
|
||||
will never be sent, even if it's timeout expires. On "update" the
|
||||
keepalive timeout of the corresponding message will be reset.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="remove"></xsd:enumeration>
|
||||
<xsd:enumeration value="update"></xsd:enumeration>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:element name="KeepaliveMessage" type="tns:TKeepaliveMessageRequest">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Keepalive message request element</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="KeepaliveMessageResponse" type="tns:TMessageID">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Response element for a keepalive request</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="EnqueueMessageResponse" type="tns:TMessageID">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Enqueue message response element</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
|
||||
|
||||
<xsd:complexType name="TEnqueueMessage">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
A complex type containing one element: The message to enqueue.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="MMessage" type="tns:TMessage">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Element containing a message to enqueue.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
|
||||
<xsd:complexType name="TKeepaliveMessageRequest">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
A complex type containing one element: The keepalive message to process.
|
||||
</xsd:documentation>
|
||||
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="MKeepaliveMessage" type="tns:TKeepliveMessage">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Element containing a keepalive message to process.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:schema>
|
||||
</wsdl:types>
|
||||
<wsdl:message name="EnqueueMessageRequest">
|
||||
<wsdl:part name="parameters" element="tns:EnqueueMessage">
|
||||
<wsdl:documentation>inputparameters for EnqueueMessag</wsdl:documentation>
|
||||
</wsdl:part>
|
||||
|
||||
</wsdl:message>
|
||||
<wsdl:message name="EnqueueMessageResponse">
|
||||
<wsdl:part name="parameters" element="tns:EnqueueMessageResponse">
|
||||
<wsdl:documentation>outputparameters for EnqueueMessag</wsdl:documentation>
|
||||
</wsdl:part>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="KeepaliveMessageRequest">
|
||||
<wsdl:part name="parameters" element="tns:KeepaliveMessage">
|
||||
|
||||
<wsdl:documentation>input parameters for KeepaliveMessag</wsdl:documentation>
|
||||
</wsdl:part>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="KeepaliveMessageResponse">
|
||||
<wsdl:part name="parameters" element="tns:KeepaliveMessageResponse">
|
||||
<wsdl:documentation>output parameters for KeepaliveMessag</wsdl:documentation>
|
||||
</wsdl:part>
|
||||
</wsdl:message>
|
||||
|
||||
<wsdl:portType name="MGWPortType">
|
||||
<wsdl:documentation>
|
||||
generic port type for all methods required for sending messages over the mosaic
|
||||
message gatewa
|
||||
</wsdl:documentation>
|
||||
<wsdl:operation name="EnqueueMessage">
|
||||
<wsdl:documentation>
|
||||
This method is used to enqueue a normal (immediate send) or a delayed message with
|
||||
keepalive functionality.
|
||||
</wsdl:documentation>
|
||||
<wsdl:input message="tns:EnqueueMessageRequest"></wsdl:input>
|
||||
<wsdl:output message="tns:EnqueueMessageResponse"></wsdl:output>
|
||||
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="KeepaliveMessage">
|
||||
<wsdl:documentation>
|
||||
This method is used to update or remove a
|
||||
keepalive message.
|
||||
</wsdl:documentation>
|
||||
<wsdl:input message="tns:KeepaliveMessageRequest"></wsdl:input>
|
||||
<wsdl:output message="tns:KeepaliveMessageResponse"></wsdl:output>
|
||||
</wsdl:operation>
|
||||
</wsdl:portType>
|
||||
|
||||
<wsdl:binding name="MGWBinding" type="tns:MGWPortType">
|
||||
<wsdl:documentation>Generic binding for all (SOAP) port</wsdl:documentation>
|
||||
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
|
||||
<wsdl:operation name="EnqueueMessage">
|
||||
<soap:operation soapAction="http://www.example.org/MessageGateway2/EnqueueMessage" />
|
||||
<wsdl:input>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="KeepaliveMessage">
|
||||
<soap:operation
|
||||
soapAction="http://www.example.org/MessageGateway2/KeepaliveMessage" />
|
||||
<wsdl:input>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:input>
|
||||
|
||||
<wsdl:output>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
</wsdl:binding>
|
||||
<wsdl:service name="MessageGateway">
|
||||
<wsdl:documentation>
|
||||
Web Service for sending messages over the mosaic message gatewa
|
||||
</wsdl:documentation>
|
||||
|
||||
<wsdl:port name="HTTPPort" binding="tns:MGWBinding">
|
||||
<wsdl:documentation>HTTP(S) port for the mosaic message gatewa</wsdl:documentation>
|
||||
<soap:address location="https://www.example.org/MessageGateway/" />
|
||||
</wsdl:port>
|
||||
</wsdl:service>
|
||||
</wsdl:definitions>};
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 12;
|
||||
use File::Spec;
|
||||
use File::Basename;
|
||||
use_ok qw(SOAP::WSDL);
|
||||
|
||||
my $path = File::Spec->rel2abs(dirname( __FILE__ ) );
|
||||
|
||||
my $soap = SOAP::WSDL->new();
|
||||
$soap->wsdl("file://$path/WSDL_NOT_FOUND.wsdl");
|
||||
|
||||
eval { $soap->wsdlinit() };
|
||||
like $@, qr{ does \s not \s exist }x, 'does not exist';
|
||||
|
||||
eval { $soap = SOAP::WSDL->new(
|
||||
wsdl => "file://$path/WSDL_NOT_FOUND.wsdl");
|
||||
};
|
||||
like $@, qr{ does \s not \s exist }x, 'does not exist (constructor)';
|
||||
|
||||
$soap = SOAP::WSDL->new();
|
||||
$soap->wsdl( "file://$path/WSDL_EMPTY_DEFINITIONS.wsdl");
|
||||
eval { $soap->wsdlinit() };
|
||||
like $@, qr{ unable \s to \s extract \s schema \s from \s WSDL }x, 'empty definition';
|
||||
|
||||
# Try out all call() variants
|
||||
eval { $soap->call('NewOperation', 'value'); };
|
||||
like $@, qr{ unable \s to \s extract \s schema \s from \s WSDL }x, 'empty definition';
|
||||
|
||||
$soap = SOAP::WSDL->new();
|
||||
$soap->wsdl( "file://$path/WSDL_NO_MESSAGE.wsdl");
|
||||
eval { $soap->wsdlinit() };
|
||||
eval { $soap->call('NewOperation', 'value'); };
|
||||
like $@, qr{ Message \s \{http://www.example.org/WSDL_1/\}NewOperationRequest \s not \s found }x, 'empty definition';
|
||||
|
||||
$soap = SOAP::WSDL->new();
|
||||
$soap->wsdl( "file://$path/WSDL_1.wsdl");
|
||||
$soap->wsdlinit();
|
||||
$soap->no_dispatch(1);
|
||||
|
||||
like $soap->call('NewOperation', NewOperation => { in => 'test' }), qr{ <in>test</in> }x;
|
||||
like $soap->call('NewOperation', { NewOperation => { in => 'test' } }), qr{ <in>test</in> }x;
|
||||
|
||||
$soap = SOAP::WSDL->new( wsdl => "file://$path/WSDL_1.wsdl",
|
||||
servicename => 'NewService',
|
||||
portname => 'NewPort',
|
||||
no_dispatch => 1,
|
||||
keep_alive => 1,
|
||||
);
|
||||
$soap->proxy('http://example.org');
|
||||
like $soap->call('NewOperation', NewOperation => { in => 'test' }), qr{ <in>test</in> }x;
|
||||
like $soap->call('NewOperation', { NewOperation => { in => 'test' } }), qr{ <in>test</in> }x;
|
||||
|
||||
|
||||
$soap = SOAP::WSDL->new( wsdl => "file://$path/WSDL_NO_BINDING.wsdl",
|
||||
servicename => 'NewService',
|
||||
portname => 'NewPort',
|
||||
no_dispatch => 1,
|
||||
);
|
||||
eval {
|
||||
$soap->call('NewOperation', { NewOperation => { in => 'test' } });
|
||||
};
|
||||
like $@, qr{ no \s binding }x, 'No binding error';
|
||||
|
||||
$soap = SOAP::WSDL->new( wsdl => "file://$path/WSDL_NO_PORTTYPE.wsdl",
|
||||
servicename => 'NewService',
|
||||
portname => 'NewPort',
|
||||
no_dispatch => 1,
|
||||
);
|
||||
eval {
|
||||
$soap->call('NewOperation', { NewOperation => { in => 'test' } });
|
||||
};
|
||||
like $@, qr{ cannot \s find \s portType }x, 'No porttype error';
|
||||
@@ -1,7 +0,0 @@
|
||||
use Test::More tests => 3;
|
||||
use lib '../lib';
|
||||
use_ok(qw/SOAP::WSDL/);
|
||||
ok( SOAP::WSDL->new(), 'Instantiated object' );
|
||||
|
||||
eval { SOAP::WSDL->new( grzlmpfh => 'unknown')};
|
||||
ok $@, 'die on illegal parameter';
|
||||
@@ -1,31 +0,0 @@
|
||||
use Test::More tests => 7;
|
||||
use strict;
|
||||
use warnings;
|
||||
use diagnostics;
|
||||
use Cwd;
|
||||
use lib '../lib';
|
||||
|
||||
use File::Basename;
|
||||
use File::Spec;
|
||||
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
my ($volume, $dir) = File::Spec->splitpath($path, 1);
|
||||
my @dir_from = File::Spec->splitdir($dir);
|
||||
unshift @dir_from, $volume if $volume;
|
||||
my $url = join '/', @dir_from;
|
||||
|
||||
use_ok(qw/SOAP::WSDL/);
|
||||
|
||||
my $soap;
|
||||
#2
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file://' . $url . '/../../acceptance/wsdl/02_port.wsdl'
|
||||
), 'Instantiated object' );
|
||||
|
||||
ok( ($soap->servicename('testService') ), 'set service' );
|
||||
ok( ($soap->portname('testPort2') ) ,'set portname');
|
||||
ok( $soap->wsdlinit(), 'parsed WSDL' );
|
||||
|
||||
ok( $soap->wsdlinit( servicename => 'testService', portname => 'testPort'), 'parsed WSDL' );
|
||||
|
||||
ok( ($soap->portname() eq 'testPort' ), 'found port passed to wsdlinit');
|
||||
@@ -1,85 +0,0 @@
|
||||
use Test::More tests => 7;
|
||||
use strict;
|
||||
use warnings;
|
||||
use lib '../lib';
|
||||
use lib 't/lib';
|
||||
use lib 'lib';
|
||||
use File::Basename;
|
||||
use File::Spec;
|
||||
our $SKIP;
|
||||
eval "use Test::SOAPMessage";
|
||||
if ($@)
|
||||
{
|
||||
$SKIP = "Test::Differences required for testing. ";
|
||||
}
|
||||
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
my ($volume, $dir) = File::Spec->splitpath($path, 1);
|
||||
my @dir_from = File::Spec->splitdir($dir);
|
||||
unshift @dir_from, $volume if $volume;
|
||||
my $url = join '/', @dir_from;
|
||||
|
||||
# print $url;
|
||||
|
||||
use_ok(qw/SOAP::WSDL/);
|
||||
|
||||
print "# SOAP::WSDL Version: $SOAP::WSDL::VERSION\n";
|
||||
|
||||
my $xml;
|
||||
my $soap;
|
||||
|
||||
#2
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file://' . $url . '/../../acceptance/wsdl/03_complexType-all.wsdl',
|
||||
), 'Instantiated object' );
|
||||
|
||||
#3
|
||||
ok $soap->wsdlinit(
|
||||
checkoccurs => 1,
|
||||
servicename => 'testService',
|
||||
), 'parse WSDL';
|
||||
ok $soap->no_dispatch(1), 'set no dispatch';
|
||||
|
||||
# won't work without - would require SOAP::WSDL::Deserializer::SOM,
|
||||
# which requires SOAP::Lite
|
||||
$soap->outputxml(1);
|
||||
|
||||
ok ($xml = $soap->call('test',
|
||||
testAll => {
|
||||
Test1 => 'Test 1',
|
||||
Test2 => [ 'Test 2', 'Test 3' ]
|
||||
}
|
||||
), 'Serialized complexType' );
|
||||
|
||||
|
||||
# print $xml;
|
||||
|
||||
# $soap->wsdl_checkoccurs(1);
|
||||
|
||||
TODO: {
|
||||
local $TODO = "not implemented yet";
|
||||
|
||||
eval
|
||||
{
|
||||
$xml = $soap->call('test',
|
||||
testAll => {
|
||||
Test1 => 'Test 1',
|
||||
Test2 => [ 'Test 2', 'Test 3' ]
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
ok( ($@ =~m/illegal\snumber\sof\selements/),
|
||||
"Died on illegal number of elements (too many)"
|
||||
);
|
||||
|
||||
eval {
|
||||
$xml = $soap->call('test',
|
||||
testAll => {
|
||||
Test1 => 'Test 1',
|
||||
}
|
||||
);
|
||||
};
|
||||
ok($@, 'Died on illegal number of elements (not enough)');
|
||||
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
use Test::More tests => 2;
|
||||
use lib '../lib';
|
||||
|
||||
use_ok qw/SOAP::WSDL/;
|
||||
|
||||
my $soap = SOAP::WSDL->new();
|
||||
|
||||
|
||||
TODO: {
|
||||
local $TODO="implement tests";
|
||||
fail "serialize choice element";
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
use Test::More tests => 2;
|
||||
use lib '../lib';
|
||||
use lib 't/lib';
|
||||
use lib 'lib';
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
|
||||
our $SKIP;
|
||||
eval "use Test::SOAPMessage";
|
||||
if ($@) {
|
||||
$SKIP = "Test::Differences required for testing. $@";
|
||||
}
|
||||
|
||||
use_ok qw/SOAP::WSDL/;
|
||||
|
||||
my $soap = SOAP::WSDL->new();
|
||||
|
||||
|
||||
TODO: {
|
||||
local $TODO="implement <complexContent> tests";
|
||||
fail "serialize complexContent element";
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
use Test::More tests => 4;
|
||||
use strict;
|
||||
use warnings;
|
||||
use lib '../lib';
|
||||
use lib 't/lib';
|
||||
use lib 'lib';
|
||||
use File::Basename;
|
||||
use File::Spec
|
||||
|
||||
use_ok(qw/SOAP::WSDL/);
|
||||
|
||||
print "# SOAP::WSDL Version: $SOAP::WSDL::VERSION\n";
|
||||
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
my ($volume, $dir) = File::Spec->splitpath($path, 1);
|
||||
my @dir_from = File::Spec->splitdir($dir);
|
||||
unshift @dir_from, $volume if $volume;
|
||||
my $url = join '/', @dir_from;
|
||||
|
||||
my $xml;
|
||||
my $soap;
|
||||
|
||||
#2
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file://' . $url . '/../../acceptance/wsdl/03_complexType-element-ref.wsdl',
|
||||
no_dispatch => 1,
|
||||
), 'Instantiated object' );
|
||||
|
||||
# won't work without - would require SOAP::WSDL::Deserializer::SOM,
|
||||
# which requires SOAP::Lite
|
||||
$soap->outputxml(1);
|
||||
|
||||
ok ($xml = $soap->call('test',
|
||||
testAll => {
|
||||
Test2 => 'Test2',
|
||||
TestRef => 'TestRef'
|
||||
}
|
||||
), 'Serialized complexType' );
|
||||
|
||||
like $xml, qr{<SOAP-ENV:Body><testAll><TestRef>TestRef</TestRef><Test2>Test2</Test2></testAll></SOAP-ENV:Body>}
|
||||
, 'element ref="" serialization';
|
||||
@@ -1,22 +0,0 @@
|
||||
use Test::More tests => 2;
|
||||
use lib '../lib';
|
||||
use lib 't/lib';
|
||||
use lib 'lib';
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
|
||||
our $SKIP;
|
||||
eval "use Test::SOAPMessage";
|
||||
if ($@) {
|
||||
$SKIP = "Test::Differences required for testing. $@";
|
||||
}
|
||||
|
||||
use_ok qw/SOAP::WSDL/;
|
||||
|
||||
my $soap = SOAP::WSDL->new();
|
||||
|
||||
|
||||
TODO: {
|
||||
local $TODO="implement <group> support";
|
||||
fail "serialize group element";
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
BEGIN {
|
||||
use Test::More tests => 6;
|
||||
use lib '../lib';
|
||||
use lib 't/lib';
|
||||
use lib 'lib';
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
|
||||
our $SKIP;
|
||||
eval "use Test::SOAPMessage";
|
||||
if ($@)
|
||||
{
|
||||
$SKIP = "Test::Differences required for testing. $@";
|
||||
}
|
||||
}
|
||||
|
||||
use_ok(qw/SOAP::WSDL/);
|
||||
|
||||
my $xml;
|
||||
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
my ($volume, $dir) = File::Spec->splitpath($path, 1);
|
||||
my @dir_from = File::Spec->splitdir($dir);
|
||||
unshift @dir_from, $volume if $volume;
|
||||
my $url = join '/', @dir_from;
|
||||
|
||||
#2
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file://' . $url . '/../../acceptance/wsdl/03_complexType-sequence.wsdl'
|
||||
), 'Instantiated object' );
|
||||
|
||||
#3
|
||||
ok( $soap->wsdlinit(
|
||||
checkoccurs => 1,
|
||||
servicename => 'testService',
|
||||
), 'parsed WSDL' );
|
||||
$soap->no_dispatch(1);
|
||||
|
||||
# won't work without - would require SOAP::WSDL::Deserializer::SOM,
|
||||
# which requires SOAP::Lite
|
||||
$soap->outputxml(1);
|
||||
|
||||
|
||||
#4
|
||||
ok $xml = $soap->call('test',
|
||||
testSequence => {
|
||||
Test1 => 'Test 1',
|
||||
Test2 => 'Test 2',
|
||||
}
|
||||
), 'Serialized complexType';
|
||||
|
||||
TODO: {
|
||||
local $TODO = "not implemented yet";
|
||||
#5
|
||||
eval
|
||||
{
|
||||
$xml = $soap->call('test',
|
||||
testSequence => {
|
||||
Test1 => 'Test 1',
|
||||
}
|
||||
);
|
||||
};
|
||||
ok( ($@),
|
||||
"Died on illegal number of elements"
|
||||
);
|
||||
|
||||
#6
|
||||
eval
|
||||
{
|
||||
$xml = $soap->call('test',
|
||||
testSequence => {
|
||||
Test1 => 'Test 1',
|
||||
Test2 => [ 1, 2, 3, ]
|
||||
}
|
||||
);
|
||||
};
|
||||
ok( ($@),
|
||||
"Died on illegal number of elements"
|
||||
);
|
||||
};
|
||||
@@ -1,22 +0,0 @@
|
||||
use Test::More tests => 2;
|
||||
use lib '../lib';
|
||||
use lib 't/lib';
|
||||
use lib 'lib';
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
|
||||
our $SKIP;
|
||||
eval "use Test::SOAPMessage";
|
||||
if ($@) {
|
||||
$SKIP = "Test::Differences required for testing. $@";
|
||||
}
|
||||
|
||||
use_ok qw/SOAP::WSDL/;
|
||||
|
||||
my $soap = SOAP::WSDL->new();
|
||||
|
||||
|
||||
TODO: {
|
||||
local $TODO="implement <simpleContent> support";
|
||||
fail "serialize simpleContent element";
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
use Test::More skip_all => 'TODO: implement tests';
|
||||
use lib '../lib';
|
||||
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
use Test::More tests => 6;
|
||||
use strict;
|
||||
use warnings;
|
||||
use lib '../lib';
|
||||
use lib 't/lib';
|
||||
|
||||
use File::Basename;
|
||||
use File::Spec;
|
||||
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
my ($volume, $dir) = File::Spec->splitpath($path, 1);
|
||||
my @dir_from = File::Spec->splitdir($dir);
|
||||
unshift @dir_from, $volume if $volume;
|
||||
my $url = join '/', @dir_from;
|
||||
|
||||
use_ok(qw/SOAP::WSDL/);
|
||||
|
||||
my $xml;
|
||||
|
||||
my $soap = undef;
|
||||
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file://' . $url . '/../../acceptance/wsdl/04_element-simpleType.wsdl'
|
||||
), 'Instantiated object' );
|
||||
|
||||
# won't work without - would require SOAP::WSDL::Deserializer::SOM,
|
||||
# which requires SOAP::Lite
|
||||
$soap->outputxml(1);
|
||||
|
||||
ok( $soap->wsdlinit(
|
||||
servicename => 'testService',
|
||||
), 'parsed WSDL' );
|
||||
$soap->no_dispatch(1);
|
||||
|
||||
ok ( $xml = $soap->call('test', testElement1 => 1 ) ,
|
||||
'Serialized (simpler) element' );
|
||||
|
||||
|
||||
TODO: {
|
||||
local $TODO="implement min/maxOccurs checks";
|
||||
|
||||
eval { $soap->call('test', testAll => [ 2, 3 ] ); };
|
||||
|
||||
like $@, qr{illegal\snumber\sof\selements}, "Died on illegal number of elements (too many)";
|
||||
|
||||
eval { $soap->call('test', testAll => undef ) };
|
||||
ok $@, 'Died on illegal number of elements (not enough)';
|
||||
}
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
use Test::More tests => 8;
|
||||
use strict;
|
||||
use warnings;
|
||||
use lib '../lib';
|
||||
use lib 't/lib';
|
||||
use File::Spec;
|
||||
use File::Basename;
|
||||
|
||||
our $SKIP;
|
||||
eval "use Test::SOAPMessage";
|
||||
if ($@) {
|
||||
$SKIP = "Test::Differences required for testing.";
|
||||
}
|
||||
|
||||
use_ok(qw/SOAP::WSDL/);
|
||||
|
||||
my $soap;
|
||||
my $xml;
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
my ($volume, $dir) = File::Spec->splitpath($path, 1);
|
||||
my @dir_from = File::Spec->splitdir($dir);
|
||||
unshift @dir_from, $volume if $volume;
|
||||
my $url = join '/', @dir_from;
|
||||
|
||||
#2
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file://' . $url . '/../../acceptance/wsdl/04_element.wsdl'
|
||||
), 'Instantiated object' );
|
||||
|
||||
#3
|
||||
$soap->readable(1);
|
||||
$soap->outputxml(1);
|
||||
|
||||
ok( $soap->wsdlinit(
|
||||
servicename => 'testService',
|
||||
), 'parsed WSDL' );
|
||||
$soap->no_dispatch(1);
|
||||
|
||||
ok ($xml = $soap->call('test',
|
||||
testElement1 => 'Test'
|
||||
), 'Serialized (simple) element' );
|
||||
|
||||
ok ($xml = $soap->call('testRef',
|
||||
testElementRef => 'Test'
|
||||
), 'Serialized (simple) element' );
|
||||
|
||||
like $xml
|
||||
, qr{<testElementRef\s\sxmlns="urn:Test">Test</testElementRef></SOAP-ENV:Body></SOAP-ENV:Envelope>}
|
||||
, 'element ref serialization result'
|
||||
;
|
||||
|
||||
TODO: {
|
||||
local $TODO="implement min/maxOccurs checks";
|
||||
|
||||
eval {
|
||||
$xml = $soap->call('test',
|
||||
testAll => [ 'Test 2', 'Test 3' ]
|
||||
);
|
||||
};
|
||||
|
||||
ok( ($@ =~m/illegal\snumber\sof\selements/),
|
||||
"Died on illegal number of elements (too many)"
|
||||
);
|
||||
|
||||
eval {
|
||||
$xml = $soap->call('test', testAll => undef );
|
||||
};
|
||||
ok($@, 'Died on illegal number of elements (not enough)');
|
||||
}
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
use Test::More tests => 8;
|
||||
use strict;
|
||||
use lib '../lib';
|
||||
use lib 't/lib';
|
||||
use File::Basename;
|
||||
use File::Spec;
|
||||
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
my ($volume, $dir) = File::Spec->splitpath($path, 1);
|
||||
my @dir_from = File::Spec->splitdir($dir);
|
||||
unshift @dir_from, $volume if $volume;
|
||||
my $url = join '/', @dir_from;
|
||||
|
||||
use_ok(qw/SOAP::WSDL/);
|
||||
|
||||
my ($soap, $xml, $xml2);
|
||||
|
||||
#2
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file://' . $url . '/../../acceptance/wsdl/05_simpleType-list.wsdl'
|
||||
), 'Instantiated object' );
|
||||
|
||||
# won't work without - would require SOAP::WSDL::Deserializer::SOM,
|
||||
# which requires SOAP::Lite
|
||||
$soap->outputxml(1);
|
||||
|
||||
#3
|
||||
ok( $soap->wsdlinit(
|
||||
servicename => 'testService',
|
||||
), 'parsed WSDL' );
|
||||
$soap->no_dispatch(1);
|
||||
|
||||
#4
|
||||
ok $xml = $soap->call('test', testAll => [ 1, 2 ] ), 'Serialize list call';
|
||||
|
||||
#5
|
||||
ok ( $xml2 = $soap->call('test', testAll => "1 2" ) , 'Serialized scalar call' );
|
||||
#6
|
||||
ok( $xml eq $xml2, 'Got expected result');
|
||||
|
||||
#7
|
||||
TODO: {
|
||||
local $TODO = "implement minLength check";
|
||||
eval { $xml = $soap->call('test', testAll => undef ) };
|
||||
ok($@, 'Died on illegal number of elements (not enough)');
|
||||
}
|
||||
|
||||
#8
|
||||
TODO: {
|
||||
local $TODO = "maxLength test not implemented";
|
||||
eval { $xml = $soap->call('test', testAll => [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 ] ) };
|
||||
ok($@, 'Died on illegal number of elements (more than maxLength)');
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
use Test::More tests => 8;
|
||||
use strict;
|
||||
use warnings;
|
||||
use diagnostics;
|
||||
use File::Spec;
|
||||
use File::Basename;
|
||||
use lib '../lib';
|
||||
use lib 't/lib';
|
||||
|
||||
use File::Basename;
|
||||
use File::Spec;
|
||||
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
my ($volume, $dir) = File::Spec->splitpath($path, 1);
|
||||
my @dir_from = File::Spec->splitdir($dir);
|
||||
unshift @dir_from, $volume if $volume;
|
||||
my $url = join '/', @dir_from;
|
||||
|
||||
use_ok(qw/SOAP::WSDL/);
|
||||
|
||||
my $xml;
|
||||
|
||||
my $soap;
|
||||
#2
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file://' . $url . '/../../acceptance/wsdl/05_simpleType-restriction.wsdl'
|
||||
), 'Instantiated object' );
|
||||
|
||||
#3
|
||||
ok( $soap->wsdlinit(
|
||||
servicename => 'testService',
|
||||
), 'parsed WSDL' );
|
||||
$soap->no_dispatch(1);
|
||||
$soap->autotype(0);
|
||||
# won't work without - would require SOAP::WSDL::Deserializer::SOM,
|
||||
# which requires SOAP::Lite
|
||||
$soap->outputxml(1);
|
||||
|
||||
#4
|
||||
ok $xml = $soap->call('test', testAll => [ 1, 2 ] ) , 'Serialize list call';
|
||||
|
||||
# print $xml, "\n";
|
||||
|
||||
TODO: {
|
||||
local $TODO = "implement minLength/maxLength checks";
|
||||
eval { $soap->call('test', testAll => [ 1, 2, 3 ] ) };
|
||||
ok($@, 'Died on illegal number of elements (too many)');
|
||||
|
||||
eval { $soap->call('test', testAll => [] ) };
|
||||
ok($@, 'Died on illegal number of elements (not enough)');
|
||||
}
|
||||
|
||||
TODO: {
|
||||
local $TODO = "minValue check not implemented ";
|
||||
eval { $xml = $soap->call('test', testAll => 0 ) };
|
||||
ok($@, 'Died on illegal value');
|
||||
}
|
||||
|
||||
TODO: {
|
||||
local $TODO = "maxValue check not implemented ";
|
||||
eval { $xml = $soap->call('test', testAll => 100 ) };
|
||||
ok($@, 'Died on illegal value');
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
use Test::More skip_all => 'Not supported yet';
|
||||
use strict;
|
||||
use warnings;
|
||||
use File::Spec;
|
||||
use File::Basename;
|
||||
|
||||
use_ok qw/SOAP::WSDL/;
|
||||
|
||||
my $xml;
|
||||
my $soap = undef;
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
|
||||
#2
|
||||
ok $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file:///' . $path . '/t/acceptance/wsdl/05_simpleType-union.wsdl'
|
||||
), 'Instantiated object';
|
||||
|
||||
#3
|
||||
ok $soap->wsdlinit(), 'parsed WSDL';
|
||||
$soap->no_dispatch(1);
|
||||
# won't work without - would require SOAP::WSDL::Deserializer::SOM,
|
||||
# which requires SOAP::Lite
|
||||
$soap->outputxml(1);
|
||||
|
||||
#4
|
||||
ok $xml = $soap->call('test', testAll => 1 ) , 'Serialized call';
|
||||
|
||||
# 6
|
||||
eval {
|
||||
$xml = $soap->serializer->method(
|
||||
$soap->call('test',
|
||||
testAll => [ 1 , 'union']
|
||||
)
|
||||
)
|
||||
};
|
||||
ok($@, 'Died on illegal number of elements (not enough)');
|
||||
|
||||
eval {
|
||||
$xml = $soap->serializer->method(
|
||||
$soap->call('test',
|
||||
testAll => undef
|
||||
)
|
||||
)
|
||||
};
|
||||
ok($@, 'Died on illegal number of elements (not enough)');
|
||||
|
||||
#8
|
||||
ok ( $xml = $soap->serializer->method( $soap->call('test2',
|
||||
testAll => 1 )
|
||||
),
|
||||
'Serialized (simple) call (list)' );
|
||||
|
||||
#9
|
||||
eval {
|
||||
$xml = $soap->serializer->method(
|
||||
$soap->call('test',
|
||||
testAll => [ 1 , 'union']
|
||||
)
|
||||
)
|
||||
};
|
||||
ok($@, 'Died on illegal number of elements (not enough)');
|
||||
@@ -1,34 +0,0 @@
|
||||
use Test::More tests => 6;
|
||||
use strict;
|
||||
use warnings;
|
||||
use diagnostics;
|
||||
use lib '../lib';
|
||||
use File::Basename;
|
||||
use File::Spec;
|
||||
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
my ($volume, $dir) = File::Spec->splitpath($path, 1);
|
||||
my @dir_from = File::Spec->splitdir($dir);
|
||||
unshift @dir_from, $volume if $volume;
|
||||
my $url = join '/', @dir_from;
|
||||
|
||||
use_ok(qw/SOAP::WSDL/);
|
||||
|
||||
my $soap;
|
||||
#2
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file://' . $url . '/../../acceptance/wsdl/02_port.wsdl',
|
||||
keep_alive => 1,
|
||||
), 'Instantiated object' );
|
||||
|
||||
ok( ($soap->servicename('testService') ), 'set service' );
|
||||
ok( ($soap->portname('testPort2') ) ,'set portname');
|
||||
ok( $soap->wsdlinit(), 'parsed WSDL' );
|
||||
|
||||
eval {
|
||||
$soap = SOAP::WSDL->new(
|
||||
wsdl => 'file:///' . $path . '/../../acceptance/wsdl/FOOBAR',
|
||||
keep_alive => 1,
|
||||
);
|
||||
};
|
||||
like $@, qr{ does \s not \s exist }x, 'error on non-existant WSDL';
|
||||
@@ -1,55 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
#######################################################################################
|
||||
#
|
||||
# 2_helloworld.t
|
||||
#
|
||||
# Acceptance test for message encoding, based on .NET wsdl and example code.
|
||||
# SOAP::WSDL's encoding doesn't I<exactly> match the .NET example, because
|
||||
# .NET doesn't always specify types (SOAP::WSDL does), and the namespace
|
||||
# prefixes chosen are different (maybe the encoding style, too ? this would be a bug !)
|
||||
#
|
||||
########################################################################################
|
||||
|
||||
use strict;
|
||||
use Test::More tests => 4;
|
||||
use lib '../../../lib/';
|
||||
use File::Basename;
|
||||
use File::Spec;
|
||||
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
my ($volume, $dir) = File::Spec->splitpath($path, 1);
|
||||
my @dir_from = File::Spec->splitdir($dir);
|
||||
unshift @dir_from, $volume if $volume;
|
||||
my $url = join '/', @dir_from;
|
||||
|
||||
use_ok q/SOAP::WSDL/;
|
||||
|
||||
### test vars END
|
||||
print "# Testing SOAP::WSDL ". $SOAP::WSDL::VERSION."\n";
|
||||
print "# Acceptance test against sample output with simple WSDL\n";
|
||||
|
||||
my $data = {
|
||||
name => 'test',
|
||||
givenName => 'test',
|
||||
};
|
||||
|
||||
my $soap = undef;
|
||||
|
||||
ok $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file://'.$url.'/../../acceptance/wsdl/11_helloworld.wsdl',
|
||||
no_dispatch => 1
|
||||
), 'Create SOAP::WSDL object';
|
||||
|
||||
# won't work without - would require SOAP::WSDL::Deserializer::SOM,
|
||||
# which requires SOAP::Lite
|
||||
$soap->outputxml(1);
|
||||
|
||||
$soap->proxy('http://helloworld/helloworld.asmx');
|
||||
|
||||
ok $soap->wsdlinit(
|
||||
servicename => 'Service1',
|
||||
), 'wsdlinit';
|
||||
|
||||
|
||||
ok $soap->call('sayHello', 'sayHello' => $data), 'soap call';
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use lib '../../../lib';
|
||||
use Test::More tests => 4;
|
||||
use SOAP::WSDL;
|
||||
use File::Basename;
|
||||
use File::Spec;
|
||||
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
my ($volume, $dir) = File::Spec->splitpath($path, 1);
|
||||
my @dir_from = File::Spec->splitdir($dir);
|
||||
unshift @dir_from, $volume if $volume;
|
||||
my $url = join '/', @dir_from;
|
||||
|
||||
print "# Using SOAP::WSDL Version $SOAP::WSDL::VERSION\n";
|
||||
|
||||
# chdir to my location
|
||||
my $soap = undef;
|
||||
|
||||
my $proxy = 'http://127.0.0.1/testPort';
|
||||
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file://' . $url . '/../../acceptance/wsdl/02_port.wsdl'
|
||||
) );
|
||||
|
||||
ok $soap->wsdlinit( url => $proxy );
|
||||
ok $soap->servicename('testService');
|
||||
ok $soap->portname('testPort');
|
||||
@@ -1,65 +0,0 @@
|
||||
package MyPart;
|
||||
use Class::Std::Fast;
|
||||
|
||||
package main;
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More qw(no_plan);
|
||||
use_ok qw(SOAP::WSDL::Client::Base);
|
||||
|
||||
my $client = SOAP::WSDL::Client::Base->new();
|
||||
|
||||
{
|
||||
no warnings qw(redefine once);
|
||||
*SOAP::WSDL::Client::call = sub { is $_[1]->{ operation }, 'sayHello', 'Called method';
|
||||
return $_[2], $_[3];
|
||||
};
|
||||
}
|
||||
|
||||
my @result = $client->call({
|
||||
operation => 'sayHello',
|
||||
soap_action => 'urn:HelloWorld#sayHello',
|
||||
style => 'document',
|
||||
body => {
|
||||
|
||||
'use' => 'literal',
|
||||
namespace => '',
|
||||
encodingStyle => '',
|
||||
parts => [qw( SOAP::WSDL::XSD::Typelib::Builtin::string )],
|
||||
},
|
||||
header => {
|
||||
parts => [qw( SOAP::WSDL::XSD::Typelib::Builtin::string )],
|
||||
},
|
||||
headerfault => {
|
||||
|
||||
}
|
||||
}, { value => 'Body' }, { value => 'Header' });
|
||||
|
||||
is $result[0], 'Body';
|
||||
is $result[1], 'Header';
|
||||
isa_ok $result[0], 'SOAP::WSDL::XSD::Typelib::Builtin::string';
|
||||
|
||||
@result = $client->call({
|
||||
operation => 'sayHello',
|
||||
soap_action => 'urn:HelloWorld#sayHello',
|
||||
style => 'document',
|
||||
body => {
|
||||
|
||||
'use' => 'literal',
|
||||
namespace => '',
|
||||
encodingStyle => '',
|
||||
parts => [qw( SOAP::WSDL::XSD::Typelib::Builtin::string )],
|
||||
},
|
||||
header => {
|
||||
parts => [qw( SOAP::WSDL::XSD::Typelib::Builtin::string )],
|
||||
},
|
||||
headerfault => {
|
||||
|
||||
}
|
||||
}, SOAP::WSDL::XSD::Typelib::Builtin::string->new({ value => 'Body2' }),
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::string->new({ value => 'Header2' })
|
||||
);
|
||||
|
||||
is $result[0], 'Body2';
|
||||
is $result[1], 'Header2';
|
||||
isa_ok $result[1], 'SOAP::WSDL::XSD::Typelib::Builtin::string';
|
||||
@@ -1,39 +0,0 @@
|
||||
use Test::More tests => 13;
|
||||
use lib '../../../lib';
|
||||
use_ok qw(SOAP::WSDL::Deserializer::Hash);
|
||||
|
||||
# Try all instanciation variants
|
||||
ok my $deserializer = SOAP::WSDL::Deserializer::Hash->new();
|
||||
ok $deserializer = SOAP::WSDL::Deserializer::Hash->new({
|
||||
class_resolver => 'SomeFunkyClass',
|
||||
});
|
||||
|
||||
ok my $data = $deserializer->deserialize(q{<a><b>1</b><b>2</b><c>3</c></a>});
|
||||
is $data->{a}->{b}->[0], 1;
|
||||
is $data->{a}->{b}->[1], 2;
|
||||
is $data->{a}->{c}, 3;
|
||||
|
||||
# need 3 elements in array to trigger all branches...
|
||||
# need ignorable whitespace to trigger removal...
|
||||
ok $data = $deserializer->deserialize(
|
||||
q{<a>
|
||||
<b><c>1</c></b>
|
||||
<b><c>2</c></b>
|
||||
<b><c>3</c></b>
|
||||
</a>});
|
||||
is $data->{a}->{b}->[0]->{c}, 1;
|
||||
is $data->{a}->{b}->[1]->{c}, 2;
|
||||
|
||||
eval { $deserializer->deserialize('grzlmpfh') };
|
||||
ok $@->isa('SOAP::WSDL::SOAP::Typelib::Fault11');
|
||||
|
||||
my $fault = $deserializer->generate_fault({
|
||||
message => 'Foo',
|
||||
code => 'Bar',
|
||||
role => 'mine',
|
||||
});
|
||||
|
||||
is $fault->get_faultstring(), 'Foo';
|
||||
|
||||
$fault = $deserializer->generate_fault({});
|
||||
is $fault->get_faultstring(), 'Unknown error';
|
||||
@@ -1,37 +0,0 @@
|
||||
use Test::More;
|
||||
|
||||
eval { require SOAP::Lite; 1; } or do {
|
||||
plan skip_all => 'SOAP::Lite not available';
|
||||
exit 0;
|
||||
};
|
||||
|
||||
print "# Using SOAP::Lite $SOAP::Lite::VERSION\n";
|
||||
|
||||
use lib '../../../lib';
|
||||
plan tests => 10;
|
||||
use_ok qw(SOAP::WSDL::Deserializer::SOM);
|
||||
|
||||
ok my $deserializer = SOAP::WSDL::Deserializer::SOM->new();
|
||||
|
||||
ok my $som = $deserializer->deserialize(q{<a><b>1</b><b>2</b><c>3</c></a>});
|
||||
my $data = $som->match('/a')->valueof;
|
||||
|
||||
is $data->{ c } , 3;
|
||||
|
||||
SKIP: {
|
||||
skip "SOAP::Lite > 0.69 required" , 2 if ($SOAP::Lite::VERSION lt '0.69');
|
||||
is $data->{ b }->[0] , 1, "array values - SOAP::Lite $SOAP::Lite::VERSION";;
|
||||
is $data->{ b }->[1] , 2, "array values - SOAP::Lite $SOAP::Lite::VERSION";;
|
||||
}
|
||||
|
||||
eval { $deserializer->generate_fault({
|
||||
role => 'soap:Server',
|
||||
code => 'Test',
|
||||
message => 'Teststring'
|
||||
});
|
||||
};
|
||||
ok $@->isa('SOAP::Fault');
|
||||
|
||||
is $@->faultcode(), 'Test';
|
||||
is $@->faultactor(), 'soap:Server';
|
||||
is $@->faultstring(), 'Teststring';
|
||||
@@ -1,27 +0,0 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
package TestResolver;
|
||||
sub get_typemap { {} };
|
||||
|
||||
package main;
|
||||
use Test::More tests => 8;
|
||||
|
||||
use SOAP::WSDL::Deserializer::XSD;
|
||||
|
||||
my $obj;
|
||||
|
||||
ok $obj = SOAP::WSDL::Deserializer::XSD->new();
|
||||
ok $obj = SOAP::WSDL::Deserializer::XSD->new({
|
||||
class_resolver => 'TestResolver',
|
||||
some_other_option => 'ignored',
|
||||
});
|
||||
|
||||
my $fault = $obj->generate_fault();
|
||||
|
||||
is $fault->get_faultstring(), 'Unknown error';
|
||||
is $fault->get_faultactor(), 'urn:localhost';
|
||||
is $fault->get_faultcode(), 'soap:Client';
|
||||
|
||||
isa_ok $obj->deserialize('rubbeldiekatz'), 'SOAP::WSDL::SOAP::Typelib::Fault11';
|
||||
isa_ok $obj->deserialize('<zumsel></zumsel>'), 'SOAP::WSDL::SOAP::Typelib::Fault11';
|
||||
isa_ok $obj->deserialize('<Envelope xmlns="huchmampf"></Envelope>'), 'SOAP::WSDL::SOAP::Typelib::Fault11';
|
||||
@@ -1,12 +0,0 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 3;
|
||||
use_ok qw(SOAP::WSDL::Expat::Base);
|
||||
|
||||
my $parser = SOAP::WSDL::Expat::Base->new();
|
||||
|
||||
eval { $parser->parse('Foobar')};
|
||||
ok $@;
|
||||
|
||||
eval { $parser->parsefile('Foobar')};
|
||||
ok $@;
|
||||
@@ -1,21 +0,0 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 3;
|
||||
|
||||
use SOAP::WSDL::Factory::Serializer;
|
||||
|
||||
eval { SOAP::WSDL::Factory::Serializer->get_serializer({
|
||||
soap_version => 'zumsl'
|
||||
}) };
|
||||
like $@, qr{^no serializer};
|
||||
|
||||
ok my $serializer = SOAP::WSDL::Factory::Serializer->get_serializer({
|
||||
soap_version => '1.1'
|
||||
});
|
||||
|
||||
SOAP::WSDL::Factory::Serializer->register('1.1', 'Hope_You_Have_No_Such_Package_Installed');
|
||||
|
||||
eval { SOAP::WSDL::Factory::Serializer->get_serializer({
|
||||
soap_version => '1.1'
|
||||
}) };
|
||||
like $@, qr{^Cannot load};
|
||||
@@ -1,21 +0,0 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 3;
|
||||
|
||||
use SOAP::WSDL::Factory::Deserializer;
|
||||
|
||||
eval { SOAP::WSDL::Factory::Deserializer->get_deserializer({
|
||||
soap_version => 'zumsl'
|
||||
}) };
|
||||
like $@, qr{^no deserializer};
|
||||
|
||||
ok my $serializer = SOAP::WSDL::Factory::Deserializer->get_deserializer({
|
||||
soap_version => '1.1'
|
||||
});
|
||||
|
||||
SOAP::WSDL::Factory::Deserializer->register('1.1', 'Hope_You_Have_No_Such_Package_Installed');
|
||||
|
||||
eval { SOAP::WSDL::Factory::Deserializer->get_deserializer({
|
||||
soap_version => '1.1'
|
||||
}) };
|
||||
like $@, qr{^Cannot load};
|
||||
@@ -1,20 +0,0 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 5;
|
||||
use Scalar::Util qw(blessed);
|
||||
use SOAP::WSDL::Factory::Transport;
|
||||
|
||||
eval { SOAP::WSDL::Factory::Transport->get_transport('zumsl') };
|
||||
like $@, qr{^no transport};
|
||||
|
||||
ok my $obj = SOAP::WSDL::Factory::Transport->get_transport('http');
|
||||
ok blessed $obj;
|
||||
|
||||
SOAP::WSDL::Factory::Transport->register('zumsl', 'Hope_You_Have_No_Such_Package_Installed');
|
||||
|
||||
eval { SOAP::WSDL::Factory::Transport->get_transport('zumsl') };
|
||||
like $@, qr{^Cannot load};
|
||||
|
||||
eval { SOAP::WSDL::Factory::Transport->register( \'zumsl', 'Foo') };
|
||||
like $@, qr{^Cannot use reference};
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More qw(no_plan);
|
||||
use Template;
|
||||
use File::Basename;
|
||||
use File::Spec;
|
||||
use SOAP::WSDL::Expat::WSDLParser;
|
||||
use SOAP::WSDL::Generator::Template::XSD;
|
||||
|
||||
my $path = dirname __FILE__;
|
||||
|
||||
my $parser = SOAP::WSDL::Expat::WSDLParser->new();
|
||||
|
||||
$parser->parse_file("$path/../../../acceptance/wsdl/006_sax_client.wsdl");
|
||||
#"$path/../../../../example/wsdl/globalweather.xml");
|
||||
my $definitions = $parser->get_data();
|
||||
|
||||
my $generator = SOAP::WSDL::Generator::Template::XSD->new({
|
||||
definitions => $definitions,
|
||||
});
|
||||
my $output = q{};
|
||||
|
||||
|
||||
$generator->generate_typemap({
|
||||
NO_POD => 1,
|
||||
output => \$output,
|
||||
});
|
||||
|
||||
ok eval $output;
|
||||
print $@ if $@;
|
||||
|
||||
#print $output;
|
||||
|
||||
$output = q{};
|
||||
$generator->generate_interface({
|
||||
NO_POD => 1,
|
||||
output => \$output,
|
||||
});
|
||||
|
||||
ok eval $output;
|
||||
print $@ if $@;
|
||||
|
||||
|
||||
# print $output;
|
||||
__END__
|
||||
|
||||
my $tt = Template->new(
|
||||
DEBUG => 1,
|
||||
EVAL_PERL => 1,
|
||||
RECURSION => 1,
|
||||
INCLUDE_PATH => "$path/../../../../lib/SOAP/WSDL/Template",
|
||||
);
|
||||
|
||||
foreach my $service (@{ $definitions->get_service }) {
|
||||
my $output;
|
||||
$tt->process( 'Interface.tt', {
|
||||
definitions => $definitions,
|
||||
service => $service,
|
||||
interface_prefix => 'MyInterface',
|
||||
type_prefix => 'MyTypes',
|
||||
TYPE_PREFIX => 'MyTypes',
|
||||
element_prefix => 'MyElement',
|
||||
}, \$output);
|
||||
die $tt->error if $tt->error();
|
||||
|
||||
ok eval $output, 'eval output';
|
||||
|
||||
print $output;
|
||||
};
|
||||
@@ -1,22 +0,0 @@
|
||||
use Test::More tests => 15;;
|
||||
use SOAP::WSDL::Generator::Visitor;
|
||||
|
||||
my $visitor = SOAP::WSDL::Generator::Visitor->new();
|
||||
|
||||
is undef, $visitor->visit_Definitions();
|
||||
is undef, $visitor->visit_Binding();
|
||||
is undef, $visitor->visit_Message();
|
||||
is undef, $visitor->visit_Operation();
|
||||
is undef, $visitor->visit_OpMessage();
|
||||
is undef, $visitor->visit_Part();
|
||||
is undef, $visitor->visit_Port();
|
||||
is undef, $visitor->visit_PortType();
|
||||
is undef, $visitor->visit_Service();
|
||||
is undef, $visitor->visit_SoapOperation();
|
||||
is undef, $visitor->visit_Types();
|
||||
|
||||
# XML Schema stuff
|
||||
is undef, $visitor->visit_XSD_Schema();
|
||||
is undef, $visitor->visit_XSD_ComplexType();
|
||||
is undef, $visitor->visit_XSD_Element();
|
||||
is undef, $visitor->visit_XSD_SimpleType();
|
||||
@@ -1,25 +0,0 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More;
|
||||
use File::Spec;
|
||||
use File::Basename;
|
||||
eval { require XML::Compile::WSDL11 }
|
||||
or plan skip_all => 'Cannot test without XML::Compile::WSDL11';
|
||||
|
||||
eval { require XML::LibXML }
|
||||
or plan skip_all => 'Cannot test without XML::LibXML';
|
||||
|
||||
plan skip_all => 'XML::Compile::WSDL11 is not functional yet';
|
||||
|
||||
plan tests => qw(no_plan);
|
||||
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
|
||||
my $libxml = XML::LibXML->new();
|
||||
my $xml = $libxml->parse_file("$path/../../../acceptance/wsdl/generator_test.wsdl");
|
||||
|
||||
my $wsdl = XML::Compile::WSDL11->new($xml);
|
||||
my $schemas = $wsdl->schemas;
|
||||
my $operation = $wsdl->operation('testHeader');
|
||||
|
||||
my $client = $operation->prepareClient();
|
||||
@@ -1,153 +0,0 @@
|
||||
use Test::More tests => 38;
|
||||
use File::Basename qw(dirname);
|
||||
use File::Spec;
|
||||
use File::Path;
|
||||
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
|
||||
use_ok qw(SOAP::WSDL::Generator::Visitor::Typelib);
|
||||
use_ok qw(SOAP::WSDL::Generator::Template::XSD);
|
||||
|
||||
use SOAP::WSDL::Expat::WSDLParser;
|
||||
|
||||
my $parser = SOAP::WSDL::Expat::WSDLParser->new();
|
||||
|
||||
my $definitions = $parser->parse_file(
|
||||
"$path/../../../acceptance/wsdl/generator_test.wsdl"
|
||||
#"$path/../../../acceptance/wsdl/elementAtomicComplexType.xml"
|
||||
);
|
||||
|
||||
my $generator = SOAP::WSDL::Generator::Template::XSD->new({
|
||||
definitions => $definitions,
|
||||
type_prefix => 'Foo',
|
||||
element_prefix => 'Foo',
|
||||
typemap_prefix => 'Foo',
|
||||
OUTPUT_PATH => "$path/testlib",
|
||||
});
|
||||
|
||||
my $code = "";
|
||||
$generator->set_output(\$code);
|
||||
$generator->generate_typelib();
|
||||
{
|
||||
eval $code;
|
||||
ok !$@;
|
||||
print $@ if $@;
|
||||
}
|
||||
# print $code;
|
||||
|
||||
|
||||
$generator->set_type_prefix('MyTypes');
|
||||
$generator->set_element_prefix('MyElements');
|
||||
$generator->set_typemap_prefix('MyTypemaps');
|
||||
$generator->set_interface_prefix('MyInterfaces');
|
||||
|
||||
$generator->set_output(undef);
|
||||
$generator->generate();
|
||||
#$generator->generate_typelib();
|
||||
#$generator->generate_typemap();
|
||||
|
||||
if (eval { require Test::Warn; }) {
|
||||
Test::Warn::warning_like( sub { $generator->generate_interface() },
|
||||
qr{\A Multiple \s parts \s detected \s in \s message \s testMultiPartWarning}xms);
|
||||
}
|
||||
else {
|
||||
$generator->generate_interface();
|
||||
SKIP: { skip 'Cannot test warnings without Test::Warn', 1 };
|
||||
}
|
||||
|
||||
$generator->generate_server();
|
||||
|
||||
eval "use lib '$path/testlib'";
|
||||
use_ok qw( MyInterfaces::testService::testPort );
|
||||
|
||||
my $interface;
|
||||
|
||||
ok $interface = MyInterfaces::testService::testPort->new(), 'instanciate interface';
|
||||
$interface->set_no_dispatch(1);
|
||||
|
||||
my $message;
|
||||
|
||||
ok $message = $interface->testHeader( { Test1 => 'Test1', Test2 => 'Test2'}
|
||||
, { Test1 => 'Header1', Test2 => 'Header2'}), 'call soap method (no_dispatch)';
|
||||
|
||||
use_ok qw(SOAP::WSDL::Expat::MessageParser);
|
||||
use_ok qw(MyTypemaps::testService);
|
||||
|
||||
$parser = SOAP::WSDL::Expat::MessageParser->new({
|
||||
class_resolver => 'MyTypemaps::testService'
|
||||
});
|
||||
|
||||
ok $parser->parse_string($message), 'parse message with header';
|
||||
ok $parser->get_header()->get_Test1(), 'Header1';ok $message = $interface->testChoice( { Test1 => 'Test1' } ), 'call soap method (no_dispatch)';
|
||||
ok $parser->get_header()->get_Test2(), 'Header2';
|
||||
|
||||
ok $parser->get_data()->get_Test1(), 'Test1';
|
||||
ok $parser->get_data()->get_Test2(), 'Test2';
|
||||
|
||||
use_ok qw(SOAP::WSDL::Transport::Loopback);
|
||||
|
||||
$interface->set_no_dispatch(undef);
|
||||
$interface->set_transport(undef);
|
||||
$interface->set_proxy('http://127.0.0.1/Test');
|
||||
|
||||
for (1..2) {
|
||||
my ($body, $header) = $interface->testHeader( { Test1 => 'Test1', Test2 => 'Test2'} , { Test1 => 'Header1', Test2 => 'Header2'});
|
||||
is $header->get_Test1(), 'Header1', 'Header content';
|
||||
is $header->get_Test2(), 'Header2', 'Header content';
|
||||
}
|
||||
|
||||
|
||||
# complexType choice test
|
||||
ok $message = $interface->testChoice( { Test1 => 'Test1' } ), 'call soap method (no_dispatch)';
|
||||
ok $message = $interface->testChoice( { Test2 => 'Test2' } ), 'call soap method (no_dispatch)';
|
||||
|
||||
TODO: {
|
||||
local $TODO = 'implement content check';
|
||||
eval { $interface->testChoice( { Test1 => 'Test1', Test2 => 'Test2' } ) };
|
||||
ok $@, 'fail on both choice options';
|
||||
}
|
||||
#
|
||||
|
||||
ok eval { require MyTypes::testComplexTypeRestriction };
|
||||
my $complexRestriction = MyTypes::testComplexTypeRestriction->new();
|
||||
$complexRestriction->set_Test1('Test');
|
||||
is $complexRestriction->get_Test1(), 'Test';
|
||||
|
||||
$complexRestriction = MyTypes::testComplexTypeRestriction->new({
|
||||
Test1 => 'test1',
|
||||
Test2 => 'test2',
|
||||
});
|
||||
is $complexRestriction->get_Test1(), 'test1';
|
||||
is $complexRestriction->get_Test2(), 'test2';
|
||||
|
||||
ok eval { require MyTypes::testComplexTypeExtension };
|
||||
$complexExtension = MyTypes::testComplexTypeExtension->new({
|
||||
Test1 => 'test1',
|
||||
Test2 => 'test2',
|
||||
Test3 => 'test3',
|
||||
});
|
||||
is $complexExtension->get_Test1(), 'test1';
|
||||
is $complexExtension->get_Test2(), 'test2';
|
||||
is $complexExtension->get_Test3(), 'test3';
|
||||
|
||||
|
||||
ok eval { require MyTypes::testComplexTypeElementAtomicSimpleType; };
|
||||
my $ct_east = MyTypes::testComplexTypeElementAtomicSimpleType->new({
|
||||
testString => 'Just some test',
|
||||
testAtomicSimpleTypeElement => 42,
|
||||
testAtomicSimpleTypeElement2 => 23,
|
||||
});
|
||||
|
||||
is $ct_east->get_testAtomicSimpleTypeElement, 42;
|
||||
is $ct_east->get_testAtomicSimpleTypeElement->get_value(), 42;
|
||||
isa_ok($ct_east->get_testAtomicSimpleTypeElement,
|
||||
'MyTypes::testComplexTypeElementAtomicSimpleType::_testAtomicSimpleTypeElement');
|
||||
|
||||
|
||||
is $ct_east->get_testAtomicSimpleTypeElement2, 23;
|
||||
is $ct_east->get_testAtomicSimpleTypeElement2->get_value(), 23;
|
||||
isa_ok($ct_east->get_testAtomicSimpleTypeElement2,
|
||||
'MyTypes::testComplexTypeElementAtomicSimpleType::_testAtomicSimpleTypeElement2');
|
||||
|
||||
|
||||
rmtree "$path/testlib";
|
||||
@@ -1,24 +0,0 @@
|
||||
use Test::More tests => 3;
|
||||
use File::Basename qw(dirname);
|
||||
use File::Spec;
|
||||
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
|
||||
use_ok qw(SOAP::WSDL::Generator::Visitor::Typelib);
|
||||
use_ok qw(SOAP::WSDL::Generator::Template::XSD);
|
||||
|
||||
use SOAP::WSDL::Expat::WSDLParser;
|
||||
|
||||
my $parser = SOAP::WSDL::Expat::WSDLParser->new();
|
||||
my $definitions = $parser->parse_file(
|
||||
"$path/../../../acceptance/wsdl/generator_unsupported_test.wsdl"
|
||||
);
|
||||
|
||||
my $generator = SOAP::WSDL::Generator::Template::XSD->new({
|
||||
definitions => $definitions,
|
||||
});
|
||||
|
||||
{
|
||||
eval { $generator->generate_typelib() };
|
||||
}
|
||||
ok $@;
|
||||
@@ -1,44 +0,0 @@
|
||||
package MyTypelib;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
|
||||
sub find_element {};
|
||||
sub find_type {};
|
||||
|
||||
package main;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 5;
|
||||
|
||||
use_ok qw(SOAP::WSDL::Part);
|
||||
|
||||
my $typelib = {};
|
||||
|
||||
eval { SOAP::WSDL::Part->serialize() };
|
||||
like $@, qr{No typelib};
|
||||
|
||||
my $opt = {
|
||||
typelib => 'MyTypelib',
|
||||
namespace => { foo => 'bar'}
|
||||
};
|
||||
|
||||
my $data = {};
|
||||
|
||||
my $part = SOAP::WSDL::Part->new();
|
||||
|
||||
eval { $part->serialize('name', $data, $opt ) };
|
||||
like $@, qr{Neither type nor element};
|
||||
|
||||
$part->set_type('foo:Foo');
|
||||
|
||||
eval { $part->serialize('name', $data, $opt ) };
|
||||
like $@, qr{type foo:Foo};
|
||||
|
||||
$part->set_type(undef);
|
||||
|
||||
$part->set_element('foo:Foo');
|
||||
|
||||
eval { $part->serialize('name', $data, $opt ) };
|
||||
like $@, qr{element foo:Foo};
|
||||
@@ -1,13 +0,0 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More qw(no_plan);
|
||||
|
||||
use_ok qw(SOAP::WSDL::Serializer::XSD);
|
||||
|
||||
my $serializer = SOAP::WSDL::Serializer::XSD->new();
|
||||
|
||||
like $serializer->serialize(), qr{<SOAP-ENV:Body></SOAP-ENV:Body>}, 'empty body';
|
||||
like $serializer->serialize({ body => {} }), qr{<SOAP-ENV:Body></SOAP-ENV:Body>}, 'empty body';
|
||||
like $serializer->serialize({ body => [] }), qr{<SOAP-ENV:Body></SOAP-ENV:Body>}, 'empty body';
|
||||
like $serializer->serialize({ header => {}, body => [] }),
|
||||
qr{<SOAP-ENV:Header></SOAP-ENV:Header><SOAP-ENV:Body></SOAP-ENV:Body>}, 'empty header and body';
|
||||
@@ -1,62 +0,0 @@
|
||||
package MyDeserializer;
|
||||
use Class::Std::Fast;
|
||||
require Test::More;
|
||||
my %class_resolver_of :ATTR(:name<class_resolver> :default<()>);
|
||||
sub generate_fault {
|
||||
Test::More::pass("generate fault on $_[1]->{ message }");
|
||||
return $_[1]->{ message };
|
||||
}
|
||||
sub deserialize {
|
||||
return ('Body', 'Header');
|
||||
}
|
||||
|
||||
package MyDeserializer2;
|
||||
use Class::Std::Fast;
|
||||
|
||||
sub deserialize {
|
||||
die "Deserialize";
|
||||
}
|
||||
sub generate_fault {
|
||||
Test::More::like($_[1]->{ message }, qr{\A Error \s deserializing }x, 'Generate fault on deserialize error' );
|
||||
return $_[1]->{ message };
|
||||
}
|
||||
|
||||
package MyHandler;
|
||||
|
||||
sub test {
|
||||
return 'Test';
|
||||
}
|
||||
|
||||
package main;
|
||||
use strict;
|
||||
use warnings;
|
||||
use HTTP::Request;
|
||||
use Test::More qw(no_plan);
|
||||
use_ok qw(SOAP::WSDL::Server);
|
||||
|
||||
my $server = SOAP::WSDL::Server->new();
|
||||
|
||||
$server->set_deserializer('MyDeserializer');
|
||||
eval { $server->handle(HTTP::Request->new()) };
|
||||
like $@, qr{\A No \s handler}x, 'No handler fault caught';
|
||||
|
||||
$server->set_dispatch_to('MyHandler');
|
||||
eval { $server->handle(HTTP::Request->new()) };
|
||||
like $@, qr{\A Not \s found: \sNo \s SOAPAction \s given}x, 'No SOAPAction fault caught';
|
||||
|
||||
my $request = HTTP::Request->new();
|
||||
$request->header('SOAPAction', 'Test');
|
||||
$server->set_dispatch_to('MyHandler');
|
||||
eval { $server->handle($request) };
|
||||
like $@, qr{\A Not \s found: \sNo \s method \s found \s for \s the \s SOAPAction \s 'Test'}x, 'No SOAPAction fault caught';
|
||||
|
||||
$server->set_action_map_ref({ Test => 'test2'});
|
||||
eval { $server->handle($request) };
|
||||
like $@, qr{\A Not \s implemented:}x, 'Not implemented fault caught';
|
||||
|
||||
|
||||
|
||||
$server->set_deserializer('MyDeserializer2');
|
||||
eval { $server->handle(HTTP::Request->new()) };
|
||||
like $@, qr{\A Error \s deserializing}x, 'Error deserializing caught';
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
package MyTypemap;
|
||||
sub get_typemap { return {} };
|
||||
|
||||
package HandlerClass;
|
||||
|
||||
sub bar {
|
||||
return "Verdammte Axt";
|
||||
}
|
||||
package main;
|
||||
use Test::More;
|
||||
eval "require IO::Scalar"
|
||||
or plan skip_all => 'IO::Scalar required for testing...';
|
||||
|
||||
plan tests => 8;
|
||||
|
||||
use_ok(SOAP::WSDL::Server);
|
||||
use_ok(SOAP::WSDL::Server::CGI);
|
||||
|
||||
my $server = SOAP::WSDL::Server::CGI->new({
|
||||
class_resolver => 'MyTypemap',
|
||||
});
|
||||
$server->set_action_map_ref({
|
||||
'testaction' => 'testmethod',
|
||||
});
|
||||
|
||||
{
|
||||
no warnings qw(once);
|
||||
*IO::Scalar::BINMODE = sub {};
|
||||
}
|
||||
my $output = q{};
|
||||
my $fh = IO::Scalar->new(\$output);
|
||||
my $stdout = *STDOUT;
|
||||
|
||||
*STDOUT = $fh;
|
||||
|
||||
$server->handle();
|
||||
|
||||
like $output, qr{ \A Status: \s 411 \s Length \s Required}x;
|
||||
$output = q{};
|
||||
|
||||
$ENV{'CONTENT_LENGTH'} = '0e0';
|
||||
$server->handle();
|
||||
|
||||
like $output, qr{ Error \s deserializing }xsm;
|
||||
$output = q{};
|
||||
|
||||
$server->set_action_map_ref({
|
||||
'foo' => 'bar',
|
||||
});
|
||||
$server->set_dispatch_to( 'HandlerClass' );
|
||||
|
||||
$server->handle();
|
||||
like $output, qr{no \s element \s found}xms;
|
||||
$output = q{};
|
||||
|
||||
$ENV{REQUEST_METHOD} = 'POST';
|
||||
$ENV{HTTP_SOAPACTION} = 'test';
|
||||
$server->handle();
|
||||
like $output, qr{no \s element \s found}xms;
|
||||
$output = q{};
|
||||
|
||||
delete $ENV{HTTP_SOAPACTION};
|
||||
|
||||
$ENV{EXPECT} = 'Foo';
|
||||
$ENV{HTTP_SOAPAction} = 'foo';
|
||||
$server->handle();
|
||||
|
||||
like $output, qr{no \s element \s found}xms;
|
||||
$output = q{};
|
||||
|
||||
$ENV{EXPECT} = '100-Continue';
|
||||
$ENV{HTTP_SOAPAction} = 'foo';
|
||||
$server->handle();
|
||||
like $output, qr{100 \s Continue}xms;
|
||||
$output = q{};
|
||||
|
||||
|
||||
*STDOUT = $stdout;
|
||||
|
||||
# print $output;
|
||||
@@ -1,49 +0,0 @@
|
||||
use Test::More tests => 9;
|
||||
use strict;
|
||||
use warnings;
|
||||
use File::Basename;
|
||||
use SOAP::WSDL::Client;
|
||||
|
||||
my $soap;
|
||||
my $base_dir = dirname( __FILE__ );
|
||||
use_ok(qw/SOAP::WSDL::Transport::Test/);
|
||||
|
||||
$soap = SOAP::WSDL::Client->new();
|
||||
$soap->set_proxy('http://somewhere.over.the.rainbow');
|
||||
|
||||
$soap->get_transport->set_base_dir( join '/', $base_dir, 'acceptance' );
|
||||
ok $soap->get_transport->get_base_dir();
|
||||
|
||||
{
|
||||
local $SIG{__WARN__} = sub {};
|
||||
my $response = $soap->call({ operation => 'test', soap_action => 'http://test' }, {});
|
||||
ok ! $response, 'Returned fault on error';
|
||||
is $response->get_faultcode(), 'soap:Server', 'faultcode';
|
||||
is $response->get_faultactor(), 'urn:localhost', 'faultactor';
|
||||
|
||||
$soap->outputxml(1);
|
||||
$response = $soap->call({ operation => 'test', soap_action => 'http://test2' }, {});
|
||||
is $response, 'test2', 'Returned file content';
|
||||
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
eval { require SOAP::WSDL::Deserializer::SOM; }
|
||||
or skip 'SOAP::WSDL::Deserializer::SOM required', 3;
|
||||
# requre SOAP::WSDL::Factory::Deserializer;
|
||||
SOAP::WSDL::Factory::Deserializer->register('1.1', 'SOAP::WSDL::Deserializer::SOM');
|
||||
|
||||
my $soap_som = SOAP::WSDL::Client->new();
|
||||
$soap_som->set_proxy('http://somewhere.over.the.rainbow');
|
||||
$soap_som->get_transport->set_base_dir( join '/', $base_dir, 'acceptance' );
|
||||
|
||||
my $som;
|
||||
ok $som = $soap_som->call({ operation => 'test', soap_action => 'http://test3' }, {})
|
||||
, 'Call with SOAP::WSDL::Deserializer::SOM';
|
||||
|
||||
# In the somewhat weird logic of SOAP::Lite, the first node inside the root element
|
||||
# is the reault, all others are output parameters (and may be accessed via "paramsout")
|
||||
is $som->result(), 'Munich', 'Result match';
|
||||
is $som->paramsout(), 'Germany' , 'Output parameter match';
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
use Test::More tests => 6;
|
||||
use strict;
|
||||
use utf8;
|
||||
|
||||
use SOAP::WSDL::Transport::HTTP;
|
||||
|
||||
my $transport = SOAP::WSDL::Transport::HTTP->new();
|
||||
|
||||
ok $transport->is_success(1);
|
||||
ok $transport->code(200);
|
||||
ok $transport->status('200 OK');
|
||||
ok $transport->message('OK');
|
||||
|
||||
my $result = $transport->send_receive(envelope => 'Test', action => 'foo');
|
||||
|
||||
ok ! $transport->is_success();
|
||||
|
||||
$result = $transport->send_receive(encoding => 'utf8', envelope => 'ÄÖÜ',
|
||||
action => 'foo');
|
||||
ok ! $transport->is_success();
|
||||
@@ -1 +0,0 @@
|
||||
test2
|
||||
@@ -1 +0,0 @@
|
||||
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" ><SOAP-ENV:Body><GetWeatherResponse xmlns="http://www.webserviceX.NET"><CityName>Munich</CityName><CountryName>Germany</CountryName></GetWeatherResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
||||
@@ -1,22 +0,0 @@
|
||||
use Test::More tests => 6;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
# use_ok fails to trigger Class::Std's overloading attributes
|
||||
use SOAP::WSDL::SOAP::Typelib::Fault11;
|
||||
|
||||
my $fault = SOAP::WSDL::SOAP::Typelib::Fault11->new({
|
||||
faultcode => 'soap:Server',
|
||||
faultstring => 'Fault message',
|
||||
});
|
||||
|
||||
ok "$fault", 'stringification';
|
||||
|
||||
if ($fault) { fail 'boolify' } else { pass 'boolify' }
|
||||
|
||||
ok ! $fault->as_bool() , 'as_bool';
|
||||
|
||||
is $fault->get_xmlns(), 'http://schemas.xmlsoap.org/soap/envelope/';
|
||||
|
||||
is $fault->get_faultcode(), 'soap:Server', 'content';
|
||||
is $fault->get_faultstring(), 'Fault message', 'content';
|
||||
@@ -1,11 +0,0 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 2; #qw(no_plan);
|
||||
|
||||
use_ok qw(SOAP::WSDL::XSD::ComplexType);
|
||||
|
||||
my $obj = SOAP::WSDL::XSD::ComplexType->new();
|
||||
$obj->set_flavor('extension');
|
||||
|
||||
eval { $obj->serialize('foo') };
|
||||
like $@, qr{sorry, \s we \s just}xsm;
|
||||
@@ -1,43 +0,0 @@
|
||||
package Foo;
|
||||
sub serialize {
|
||||
return "serialized $_[1] $_[2]";
|
||||
}
|
||||
package main;
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 12;
|
||||
|
||||
use_ok qw(SOAP::WSDL::XSD::Element);
|
||||
|
||||
my $element = SOAP::WSDL::XSD::Element->new();
|
||||
|
||||
is $element->first_simpleType(), undef;
|
||||
|
||||
$element->set_simpleType('Foo');
|
||||
is $element->first_simpleType(), 'Foo';
|
||||
|
||||
$element->set_simpleType( [ 'Foo', 'Bar' ]);
|
||||
is $element->first_simpleType(), 'Foo';
|
||||
|
||||
is $element->first_complexType(), undef;
|
||||
|
||||
$element->set_complexType('Foo');
|
||||
is $element->first_complexType(), 'Foo';
|
||||
|
||||
$element->set_complexType( [ 'Foo', 'Bar' ]);
|
||||
is $element->first_complexType(), 'Foo';
|
||||
|
||||
$element->set_default('Foo');
|
||||
is $element->serialize('Foobar', undef, { namespace => {} } ), 'serialized Foobar Foo';
|
||||
|
||||
$element->set_name('Bar');
|
||||
is $element->serialize(undef, undef, { namespace => {} } ), 'serialized Bar Foo';
|
||||
|
||||
$element->set_fixed('Foobar');
|
||||
is $element->serialize(undef, undef, { namespace => {} } ), 'serialized Bar Foobar';
|
||||
|
||||
$element->set_abstract('1');
|
||||
is $element->serialize('Bar', undef, { namespace => {} } ), 'serialized Bar Foobar';
|
||||
|
||||
eval { $element->serialize(undef, undef, { namespace => {} } ) };
|
||||
like $@, qr{cannot \s serialize \s abstract}xms;
|
||||
@@ -1,33 +0,0 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 11;
|
||||
|
||||
use_ok qw(SOAP::WSDL::XSD::SimpleType);
|
||||
|
||||
my $obj = SOAP::WSDL::XSD::SimpleType->new();
|
||||
|
||||
$obj->set_list({ LocalName => 'foo', Value => 'bar'},
|
||||
{ LocalName => 'itemType', Value => 'xsd:int'} );
|
||||
is $obj->get_flavor(), 'list';
|
||||
is $obj->get_itemType(), 'xsd:int';
|
||||
|
||||
is $obj->serialize('Foo', ['Foo', 'Bar']), '<Foo>Foo Bar</Foo>';
|
||||
|
||||
$obj->set_union({ LocalName => 'foo', Value => 'bar'},
|
||||
{ LocalName => 'memberTypes', Value => 'xsd:int'} );
|
||||
is $obj->get_flavor(), 'union';
|
||||
is $obj->get_base()->[0], 'xsd:int';
|
||||
|
||||
$obj->set_union({ LocalName => 'foo', Value => 'bar'},
|
||||
{ LocalName => 'memberTypes', Value => 'xsd:int xsd:string'} );
|
||||
is $obj->get_flavor(), 'union';
|
||||
is $obj->get_base()->[1], 'xsd:string';
|
||||
|
||||
is $obj->serialize('Foo', 'Foobar'), '<Foo>Foobar</Foo>';
|
||||
|
||||
$obj->set_flavor('enumeration');
|
||||
is $obj->serialize('Foo', 'Foobar'), '<Foo>Foobar</Foo>';
|
||||
|
||||
# TODO die on non-serializable content...
|
||||
$obj->set_flavor('');
|
||||
is $obj->serialize('Foo', 'Foobar'), '';
|
||||
@@ -1,104 +0,0 @@
|
||||
use Test::More tests => 176;
|
||||
use Scalar::Util qw(blessed);
|
||||
|
||||
# use SOAP::WSDL::XSD::Typelib::Builtin::anyType;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::anyURI;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::base64Binary;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::boolean;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::byte;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::date;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::dateTime;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::decimal;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::double;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::duration;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::ENTITY;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::float;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::gDay;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::gMonth;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::gMonthDay;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::gYear;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::gYearMonth;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::hexBinary;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::ID;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::IDREF;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::IDREFS;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::int;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::integer;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::language;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::long;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::Name;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::NCName;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::NMTOKEN;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::NMTOKENS;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::negativeInteger;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::nonNegativeInteger;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::nonPositiveInteger;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::normalizedString;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::NOTATION;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::positiveInteger;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::QName;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::short;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::string;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::time;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::token;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::unsignedByte;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::unsignedInt;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::unsignedLong;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::unsignedShort;
|
||||
|
||||
|
||||
for (
|
||||
qw(
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::anyURI
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::base64Binary
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::boolean
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::byte
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::date
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::dateTime
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::decimal
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::double
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::duration
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::ENTITY
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::float
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::gDay
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::gMonth
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::gMonthDay
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::gYear
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::gYearMonth
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::hexBinary
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::ID
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::IDREF
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::IDREFS
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::int
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::integer
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::language
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::long
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::Name
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::NCName
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::negativeInteger
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::NMTOKEN
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::NMTOKENS
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::nonNegativeInteger
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::nonPositiveInteger
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::normalizedString
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::NOTATION
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::positiveInteger
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::QName
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::short
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::string
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::time
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::token
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::unsignedByte
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::unsignedInt
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::unsignedLong
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::unsignedShort
|
||||
) ) {
|
||||
my $obj = $_->new();
|
||||
ok blessed $obj;
|
||||
is $obj->get_value(), undef;
|
||||
$obj = $_->new({});
|
||||
ok blessed $obj;
|
||||
is $obj->get_value(), undef;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
use Test::More tests => 9;
|
||||
use strict;
|
||||
use warnings;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::ENTITY;
|
||||
my $ENTITY = SOAP::WSDL::XSD::Typelib::Builtin::ENTITY->new();
|
||||
|
||||
is $ENTITY->get_value(), undef;
|
||||
$ENTITY->set_value(127);
|
||||
is "$ENTITY", "127", 'stringification';
|
||||
ok $ENTITY = SOAP::WSDL::XSD::Typelib::Builtin::ENTITY->new({ value => 127 });
|
||||
is "$ENTITY", "127", 'stringification';
|
||||
undef $ENTITY;
|
||||
|
||||
$ENTITY = SOAP::WSDL::XSD::Typelib::Builtin::ENTITY->new({});
|
||||
is $ENTITY->get_value(), undef;
|
||||
ok $ENTITY = SOAP::WSDL::XSD::Typelib::Builtin::ENTITY->new({ value => 127 });
|
||||
is "$ENTITY", "127", 'stringification';
|
||||
is $ENTITY->get_value(), "127", 'stringification';
|
||||
ok $ENTITY->isa('SOAP::WSDL::XSD::Typelib::Builtin::NCName'), 'inheritance';
|
||||
@@ -1,12 +0,0 @@
|
||||
use Test::More tests => 5;
|
||||
use strict;
|
||||
use warnings;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::ID;
|
||||
my $ID = SOAP::WSDL::XSD::Typelib::Builtin::ID->new();
|
||||
is $ID->get_value(), undef;
|
||||
$ID = SOAP::WSDL::XSD::Typelib::Builtin::ID->new({});
|
||||
is $ID->get_value(), undef;
|
||||
ok $ID = SOAP::WSDL::XSD::Typelib::Builtin::ID->new({ value => 'Test' });
|
||||
is "$ID", 'Test', 'stringification';
|
||||
|
||||
ok $ID->isa('SOAP::WSDL::XSD::Typelib::Builtin::NCName'), 'inheritance';
|
||||
@@ -1,12 +0,0 @@
|
||||
use Test::More tests => 5;
|
||||
use strict;
|
||||
use warnings;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::IDREF;
|
||||
my $IDREF = SOAP::WSDL::XSD::Typelib::Builtin::IDREF->new();
|
||||
is $IDREF->get_value(), undef;
|
||||
$IDREF = SOAP::WSDL::XSD::Typelib::Builtin::IDREF->new({});
|
||||
is $IDREF->get_value(), undef;
|
||||
ok $IDREF = SOAP::WSDL::XSD::Typelib::Builtin::IDREF->new({ value => 127 });
|
||||
is "$IDREF", "127", 'stringification';
|
||||
|
||||
ok $IDREF->isa('SOAP::WSDL::XSD::Typelib::Builtin::NCName'), 'inheritance';
|
||||
@@ -1,16 +0,0 @@
|
||||
use Test::More tests => 8;
|
||||
use strict;
|
||||
use warnings;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::IDREFS;
|
||||
my $IDREFS = SOAP::WSDL::XSD::Typelib::Builtin::IDREFS->new();
|
||||
is $IDREFS->get_value(), undef;
|
||||
$IDREFS = SOAP::WSDL::XSD::Typelib::Builtin::IDREFS->new({});
|
||||
is $IDREFS->get_value(), undef;
|
||||
ok $IDREFS = SOAP::WSDL::XSD::Typelib::Builtin::IDREFS->new({ value => [ 127 , 'Test' ] });
|
||||
is $IDREFS->serialize(), "127 Test", 'stringification';
|
||||
|
||||
ok $IDREFS = SOAP::WSDL::XSD::Typelib::Builtin::IDREFS->new({ value => 'Test' });
|
||||
is "$IDREFS", "Test", 'stringification';
|
||||
|
||||
ok $IDREFS->isa('SOAP::WSDL::XSD::Typelib::Builtin::IDREF'), 'inheritance';
|
||||
ok $IDREFS->isa('SOAP::WSDL::XSD::Typelib::Builtin::list'), 'inheritance';
|
||||
@@ -1,12 +0,0 @@
|
||||
use Test::More tests => 5;
|
||||
use strict;
|
||||
use warnings;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::NCName;
|
||||
my $NCName = SOAP::WSDL::XSD::Typelib::Builtin::NCName->new();
|
||||
is $NCName->get_value(), undef;
|
||||
$NCName = SOAP::WSDL::XSD::Typelib::Builtin::NCName->new({});
|
||||
is $NCName->get_value(), undef;
|
||||
ok $NCName = SOAP::WSDL::XSD::Typelib::Builtin::NCName->new({ value => 'Test' });
|
||||
is "$NCName", "Test", 'stringification';
|
||||
|
||||
ok $NCName->isa('SOAP::WSDL::XSD::Typelib::Builtin::Name'), 'inheritance';
|
||||
@@ -1,12 +0,0 @@
|
||||
use Test::More tests => 5;
|
||||
use strict;
|
||||
use warnings;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::token;
|
||||
my $token = SOAP::WSDL::XSD::Typelib::Builtin::token->new();
|
||||
is $token->get_value(), undef;
|
||||
$token = SOAP::WSDL::XSD::Typelib::Builtin::token->new({});
|
||||
is $token->get_value(), undef;
|
||||
ok $token = SOAP::WSDL::XSD::Typelib::Builtin::token->new({ value => 127 });
|
||||
is "$token", "127", 'stringification';
|
||||
|
||||
ok $token->isa('SOAP::WSDL::XSD::Typelib::Builtin::normalizedString'), 'inheritance';
|
||||
@@ -1,21 +0,0 @@
|
||||
use Test::More tests => 9;
|
||||
use strict;
|
||||
use warnings;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::NMTOKENS;
|
||||
my $NMTOKENS = SOAP::WSDL::XSD::Typelib::Builtin::NMTOKENS->new();
|
||||
is $NMTOKENS->get_value(), undef;
|
||||
$NMTOKENS = SOAP::WSDL::XSD::Typelib::Builtin::NMTOKENS->new({});
|
||||
is $NMTOKENS->get_value(), undef;
|
||||
ok $NMTOKENS = SOAP::WSDL::XSD::Typelib::Builtin::NMTOKENS->new({ value => [ 127 , 'Test' ] });
|
||||
|
||||
is $NMTOKENS->serialize, '127 Test', 'stringification';
|
||||
|
||||
ok $NMTOKENS = SOAP::WSDL::XSD::Typelib::Builtin::NMTOKENS->new({ value => 'Test' });
|
||||
is "$NMTOKENS", "Test", 'stringification';
|
||||
|
||||
$NMTOKENS = SOAP::WSDL::XSD::Typelib::Builtin::NMTOKENS->new({ value => undef });
|
||||
is $NMTOKENS, undef, 'stringification';
|
||||
|
||||
|
||||
ok $NMTOKENS->isa('SOAP::WSDL::XSD::Typelib::Builtin::NMTOKEN'), 'inheritance';
|
||||
ok $NMTOKENS->isa('SOAP::WSDL::XSD::Typelib::Builtin::list'), 'inheritance';
|
||||
@@ -1,12 +0,0 @@
|
||||
use Test::More tests => 5;
|
||||
use strict;
|
||||
use warnings;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::NOTATION;
|
||||
my $NOTATION = SOAP::WSDL::XSD::Typelib::Builtin::NOTATION->new();
|
||||
is $NOTATION->get_value(), undef;
|
||||
$NOTATION = SOAP::WSDL::XSD::Typelib::Builtin::NOTATION->new({});
|
||||
is $NOTATION->get_value(), undef;
|
||||
ok $NOTATION = SOAP::WSDL::XSD::Typelib::Builtin::NOTATION->new({ value => 'Test' });
|
||||
is "$NOTATION", "Test", 'stringification';
|
||||
|
||||
ok $NOTATION->isa('SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType'), 'inheritance';
|
||||
@@ -1,12 +0,0 @@
|
||||
use Test::More tests => 5;
|
||||
use strict;
|
||||
use warnings;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::Name;
|
||||
my $Name = SOAP::WSDL::XSD::Typelib::Builtin::Name->new();
|
||||
is $Name->get_value(), undef;
|
||||
$Name = SOAP::WSDL::XSD::Typelib::Builtin::Name->new({});
|
||||
is $Name->get_value(), undef;
|
||||
ok $Name = SOAP::WSDL::XSD::Typelib::Builtin::Name->new({ value => 'xsd:Test' });
|
||||
is "$Name", "xsd:Test", 'stringification';
|
||||
|
||||
ok $Name->isa('SOAP::WSDL::XSD::Typelib::Builtin::normalizedString'), 'inheritance';
|
||||
@@ -1,62 +0,0 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 23;
|
||||
use Scalar::Util qw(blessed);
|
||||
use lib '../../../../../../lib';
|
||||
use_ok qw(SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType);
|
||||
|
||||
my $obj = SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType->new();
|
||||
|
||||
my $id = ${ $obj };
|
||||
undef $obj;
|
||||
|
||||
$obj = SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType->new();
|
||||
|
||||
is ${ $obj }, $id;
|
||||
|
||||
ok blessed $obj, 'constructor returned blessed reference';
|
||||
|
||||
$obj = SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType->new({ value => 'test1' });
|
||||
|
||||
ok blessed $obj, 'constructor returned blessed reference';
|
||||
is $obj->get_value(), 'test1', 'get_value';
|
||||
|
||||
is $obj->get_xmlns(), 'http://www.w3.org/2001/XMLSchema', 'get_xmlns';
|
||||
|
||||
|
||||
is $obj->start_tag({ name => 'test' }), '<test >', 'start_tag';
|
||||
is $obj->end_tag({ name => 'test' }), '</test >', 'end_tag';
|
||||
|
||||
ok $obj->set_value('test'), 'set_value';
|
||||
is $obj->get_value(), 'test', 'get_value';
|
||||
|
||||
is "$obj", q{test}, 'stringification overloading';
|
||||
is $obj->serialize, q{test}, 'stringification overloading';
|
||||
|
||||
ok ($obj)
|
||||
? pass 'boolean overloading'
|
||||
: fail 'boolean overloading';
|
||||
|
||||
ok ! $obj->set_value(undef), 'set_value with explicit undef';
|
||||
is $obj->get_value(), undef, 'get_value';
|
||||
|
||||
{
|
||||
no warnings qw(uninitialized);
|
||||
is "$obj", q{}, 'stringification overloading';
|
||||
}
|
||||
is $obj->serialize, q{}, 'stringification overloading';
|
||||
|
||||
ok $obj = SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType->new({
|
||||
value => 'test2',
|
||||
});
|
||||
|
||||
is $obj->get_value(), 'test2', 'get_value on attr value';
|
||||
|
||||
$obj->set_value(undef);
|
||||
|
||||
is $obj->serialize({ name => 'foo' }), '<foo ></foo >'
|
||||
, 'serialize undef value with name';
|
||||
is $obj->serialize(), q{}, 'serialize undef value without name';
|
||||
|
||||
|
||||
ok $obj->isa('SOAP::WSDL::XSD::Typelib::Builtin::anyType'), 'inheritance';
|
||||
@@ -1,32 +0,0 @@
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 3;
|
||||
use Scalar::Util qw(blessed);
|
||||
use_ok qw(SOAP::WSDL::XSD::Typelib::Builtin::anyType);
|
||||
|
||||
is SOAP::WSDL::XSD::Typelib::Builtin::anyType->get_xmlns(), 'http://www.w3.org/2001/XMLSchema', 'get_xmlns';
|
||||
is SOAP::WSDL::XSD::Typelib::Builtin::anyType->serialize(), q{}, 'serialize to empty';
|
||||
|
||||
exit 0;
|
||||
|
||||
__END__
|
||||
|
||||
# cannot instantiate abstract type...
|
||||
|
||||
my $obj = SOAP::WSDL::XSD::Typelib::Builtin::anyType->new();
|
||||
|
||||
ok blessed $obj, 'constructor returned blessed reference';
|
||||
|
||||
$obj = SOAP::WSDL::XSD::Typelib::Builtin::anyType->new({
|
||||
xmlns => 'urn:Siemens.mosaic'
|
||||
});
|
||||
|
||||
ok blessed $obj, 'constructor returned blessed reference';
|
||||
|
||||
is $obj->get_xmlns(), 'http://www.w3.org/2001/XMLSchema', 'get_xmlns';
|
||||
|
||||
is $obj->start_tag({ name => 'test' }), '<test >', 'start_tag';
|
||||
is $obj->end_tag({ name => 'test' }), '</test >', 'end_tag';
|
||||
|
||||
is "$obj", q{}, 'serialize overloading';
|
||||
@@ -1,14 +0,0 @@
|
||||
use Test::More tests => 7;
|
||||
use strict;
|
||||
use warnings;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::anyURI;
|
||||
my $anyURI = SOAP::WSDL::XSD::Typelib::Builtin::anyURI->new();
|
||||
is $anyURI->get_value(), undef;
|
||||
$anyURI = SOAP::WSDL::XSD::Typelib::Builtin::anyURI->new({});
|
||||
is $anyURI->get_value(), undef;
|
||||
ok $anyURI = SOAP::WSDL::XSD::Typelib::Builtin::anyURI->new({ value => 'isbn:1234567' });
|
||||
is "$anyURI", "isbn:1234567", 'stringification';
|
||||
ok $anyURI->set_value('http://example.org');
|
||||
is "$anyURI", 'http://example.org', 'stringification';
|
||||
$anyURI = SOAP::WSDL::XSD::Typelib::Builtin::anyURI->new();
|
||||
ok $anyURI->isa('SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType'), 'inheritance';
|
||||
@@ -1,15 +0,0 @@
|
||||
use Test::More tests => 6;
|
||||
use strict;
|
||||
use warnings;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::base64Binary;
|
||||
my $obj = SOAP::WSDL::XSD::Typelib::Builtin::base64Binary->new();
|
||||
{
|
||||
no warnings qw(uninitialized);
|
||||
is "$obj", '', 'stringification';
|
||||
}
|
||||
ok defined $obj;
|
||||
ok $obj->set_value('AAAA==');
|
||||
ok $obj = SOAP::WSDL::XSD::Typelib::Builtin::base64Binary->new({ value => 'AAAA==' });
|
||||
is "$obj", 'AAAA==', 'stringification';
|
||||
|
||||
ok $obj->isa('SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType'), 'inheritance';
|
||||
@@ -1,68 +0,0 @@
|
||||
use Test::More tests => 29;
|
||||
use strict;
|
||||
use warnings;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::boolean;
|
||||
|
||||
my $bool;
|
||||
$bool = SOAP::WSDL::XSD::Typelib::Builtin::boolean->new();
|
||||
ok defined $bool;
|
||||
|
||||
is "$bool", '', 'serialized undef to empty string';
|
||||
|
||||
$bool = SOAP::WSDL::XSD::Typelib::Builtin::boolean->new({});
|
||||
ok defined $bool;
|
||||
|
||||
ok $bool = SOAP::WSDL::XSD::Typelib::Builtin::boolean->new({ value => 'true' });
|
||||
|
||||
is $bool * 1 , 1, 'numerification';
|
||||
ok $bool, 'boolification';
|
||||
|
||||
is $bool->serialize(), 'true', 'serialization';
|
||||
|
||||
$bool->set_value('1');
|
||||
is $bool->serialize(), 'true';
|
||||
is "$bool", 1, 'stringification';
|
||||
$bool ? pass 'boolification' : fail 'boolification';
|
||||
|
||||
$bool->set_value('0');
|
||||
is $bool->serialize(), 'false';
|
||||
! $bool ? pass 'boolification' : fail 'boolification';
|
||||
|
||||
$bool->set_value(undef);
|
||||
is $bool->serialize(), 'false';
|
||||
! $bool ? pass 'boolification' : fail 'boolification';
|
||||
|
||||
|
||||
$bool->set_value('false');
|
||||
|
||||
if ($bool) {
|
||||
fail 'boolification';
|
||||
}
|
||||
else {
|
||||
pass 'boolification';
|
||||
}
|
||||
|
||||
is "$bool", '0', 'stringification';
|
||||
|
||||
ok $bool->isa('SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType'), 'inheritance';
|
||||
|
||||
is $bool->serialize({ name => 'test'}), '<test >false</test >';
|
||||
is $bool->serialize(), 'false';
|
||||
|
||||
$bool->delete_value();
|
||||
is $bool->serialize, '', 'serialized undef to empty string';
|
||||
is "$bool", '', 'stringified undef to empty string';
|
||||
$bool->set_value('');
|
||||
|
||||
is $bool->serialize, 'false', 'serialized empty string to false';
|
||||
is "$bool", 0, 'stringified empty string to 0';
|
||||
|
||||
$SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType::___value->{ ${ $bool } } = 'true';
|
||||
is $bool->serialize(), 'true', 'serialization';
|
||||
is "$bool", 1, 'stringification';
|
||||
is 3 * $bool, 3, 'numerification';
|
||||
|
||||
$SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType::___value->{ ${ $bool } } = 'false';
|
||||
is $bool->serialize(), 'false', 'serialization';
|
||||
is "$bool", 0, 'numerification';
|
||||
is 3 * $bool, 0, 'stringification';
|
||||
@@ -1,12 +0,0 @@
|
||||
use Test::More tests => 6;
|
||||
use strict;
|
||||
use warnings;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::byte;
|
||||
my $byte = SOAP::WSDL::XSD::Typelib::Builtin::byte->new();
|
||||
ok defined $byte;
|
||||
ok $byte->set_value('127');
|
||||
ok $byte = SOAP::WSDL::XSD::Typelib::Builtin::byte->new({ value => 127 });
|
||||
is $byte * 1, 127, 'numerification';
|
||||
is "$byte", "127", 'stringification';
|
||||
|
||||
ok $byte->isa('SOAP::WSDL::XSD::Typelib::Builtin::short'), 'inheritance';
|
||||
@@ -1,81 +0,0 @@
|
||||
use Test::More tests => 30;
|
||||
use strict;
|
||||
use warnings;
|
||||
#use Carp qw(cluck);
|
||||
#
|
||||
#$SIG{__WARN__} = sub { cluck @_ };
|
||||
#use warnings;
|
||||
use lib '../lib';
|
||||
use Date::Format;
|
||||
use Date::Parse;
|
||||
use_ok('SOAP::WSDL::XSD::Typelib::Builtin::date');
|
||||
my $obj;
|
||||
|
||||
sub timezone {
|
||||
my @time = map { defined $_ ? $_ : 0 } strptime shift;
|
||||
my $tz = strftime('%z', @time);
|
||||
substr $tz, -2, 0, ':';
|
||||
return $tz;
|
||||
}
|
||||
|
||||
my %dates = (
|
||||
'2007/12/31' => '2007-12-31',
|
||||
'2007:08:31' => '2007-08-31',
|
||||
'30 Aug 2007' => '2007-08-30',
|
||||
);
|
||||
|
||||
my %localized_date_of = (
|
||||
'2007-12-31T00:00:00.0000000+0000' => '2007-12-31+00:00',
|
||||
'2007-12-31T00:00:00.0000000+0130' => '2007-12-31+01:30',
|
||||
'2007-12-31T00:00:00.0000000+0200' => '2007-12-31+02:00',
|
||||
'2007-12-31T00:00:00.0000000+0300' => '2007-12-31+03:00',
|
||||
'2007-12-31T00:00:00.0000000+0400' => '2007-12-31+04:00',
|
||||
'2007-12-31T00:00:00.0000000+0500' => '2007-12-31+05:00',
|
||||
'2007-12-31T00:00:00.0000000+0600' => '2007-12-31+06:00',
|
||||
'2007-12-31T00:00:00.0000000+0700' => '2007-12-31+07:00',
|
||||
'2007-12-31T00:00:00.0000000+0800' => '2007-12-31+08:00',
|
||||
'2007-12-31T00:00:00.0000000+0900' => '2007-12-31+09:00',
|
||||
'2007-12-31T00:00:00.0000000+1000' => '2007-12-31+10:00',
|
||||
'2007-12-31T00:00:00.0000000+1100' => '2007-12-31+11:00',
|
||||
'2007-12-31T00:00:00.0000000+1200' => '2007-12-31+12:00',
|
||||
'2007-12-31T00:00:00.0000000-0100' => '2007-12-31-01:00',
|
||||
'2007-12-31T00:00:00.0000000-0200' => '2007-12-31-02:00',
|
||||
'2007-12-31T00:00:00.0000000-0300' => '2007-12-31-03:00',
|
||||
'2007-12-31T00:00:00.0000000-0400' => '2007-12-31-04:00',
|
||||
'2007-12-31T00:00:00.0000000-0500' => '2007-12-31-05:00',
|
||||
'2007-12-31T00:00:00.0000000-0600' => '2007-12-31-06:00',
|
||||
'2007-12-31T00:00:00.0000000-0700' => '2007-12-31-07:00',
|
||||
'2007-12-31T00:00:00.0000000-0800' => '2007-12-31-08:00',
|
||||
'2007-12-31T00:00:00.0000000-0900' => '2007-12-31-09:00',
|
||||
'2007-12-31T00:00:00.0000000-1000' => '2007-12-31-10:00',
|
||||
'2007-12-31T00:00:00.0000000-1100' => '2007-12-31-11:00',
|
||||
'2007-12-31T00:00:00.0000000-1200' => '2007-12-31-12:00',
|
||||
|
||||
|
||||
);
|
||||
|
||||
$obj = SOAP::WSDL::XSD::Typelib::Builtin::date->new();
|
||||
$obj = SOAP::WSDL::XSD::Typelib::Builtin::date->new({});
|
||||
$obj = SOAP::WSDL::XSD::Typelib::Builtin::date->new({
|
||||
value => '2007-12-31'
|
||||
});
|
||||
|
||||
while (my ($date, $converted) = each %localized_date_of ) {
|
||||
|
||||
$obj = SOAP::WSDL::XSD::Typelib::Builtin::date->new();
|
||||
$obj->set_value( $date );
|
||||
|
||||
is $obj->get_value() , $converted , 'conversion';
|
||||
}
|
||||
|
||||
while (my ($date, $converted) = each %dates ) {
|
||||
|
||||
$obj = SOAP::WSDL::XSD::Typelib::Builtin::date->new();
|
||||
$obj->set_value( $date );
|
||||
|
||||
is $obj->get_value() , $converted . timezone($date), 'conversion';
|
||||
}
|
||||
|
||||
$obj->set_value( '2037-12-31+12:00' );
|
||||
is $obj->get_value() , '2037-12-31+12:00', 'no conversion on match';
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use lib '../lib';
|
||||
use Test::More tests => 7;
|
||||
use Date::Parse;
|
||||
use Date::Format;
|
||||
|
||||
sub timezone {
|
||||
my @time = strptime shift;
|
||||
my $tz = strftime('%z', @time);
|
||||
substr $tz, -2, 0, ':';
|
||||
return $tz;
|
||||
}
|
||||
|
||||
use_ok('SOAP::WSDL::XSD::Typelib::Builtin::dateTime');
|
||||
|
||||
print "# timezone is " . timezone( scalar localtime(time) ) . "\n";
|
||||
my $obj;
|
||||
my %dates = (
|
||||
'2007-12-31 12:32' => '2007-12-31T12:32:00',
|
||||
'2007-08-31 00:32' => '2007-08-31T00:32:00',
|
||||
'30 Aug 2007' => '2007-08-30T00:00:00',
|
||||
);
|
||||
|
||||
$obj = SOAP::WSDL::XSD::Typelib::Builtin::dateTime->new();
|
||||
$obj = SOAP::WSDL::XSD::Typelib::Builtin::dateTime->new({});
|
||||
$obj = SOAP::WSDL::XSD::Typelib::Builtin::dateTime->new({ value => '2007-08-31T00:32:00' });
|
||||
|
||||
while (my ($date, $converted) = each %dates ) {
|
||||
|
||||
$obj = SOAP::WSDL::XSD::Typelib::Builtin::dateTime->new();
|
||||
$obj->set_value( $date );
|
||||
|
||||
is $obj->get_value() , $converted . timezone($date), 'conversion with timezone';
|
||||
}
|
||||
$obj->set_value('2007-12-31T00:00:00.0000000+01:00');
|
||||
is $obj->get_value(), '2007-12-31T00:00:00.0000000+01:00';
|
||||
|
||||
$obj->set_value(undef);
|
||||
is $obj->get_value(), undef;
|
||||
eval { $obj->set_value(1) };
|
||||
ok $@, 'Die on illegal datetime';
|
||||
@@ -1,15 +0,0 @@
|
||||
use Test::More tests => 6;
|
||||
use strict;
|
||||
use warnings;
|
||||
use Scalar::Util qw(blessed);
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::decimal;
|
||||
my $decimal = SOAP::WSDL::XSD::Typelib::Builtin::decimal->new();
|
||||
ok blessed $decimal;
|
||||
is $decimal->get_value(), undef;
|
||||
ok $decimal = SOAP::WSDL::XSD::Typelib::Builtin::decimal->new({ value => 127 });
|
||||
is $decimal * 1, 127, 'numerification';
|
||||
is "$decimal", "127", 'stringification';
|
||||
|
||||
ok $decimal->isa('SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType'), 'inheritance';
|
||||
|
||||
# TODO: test range (bigint)
|
||||
@@ -1,13 +0,0 @@
|
||||
use Test::More tests => 4;
|
||||
use strict;
|
||||
use warnings;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::double;
|
||||
my $double = SOAP::WSDL::XSD::Typelib::Builtin::double->new();
|
||||
|
||||
ok $double = SOAP::WSDL::XSD::Typelib::Builtin::double->new({ value => 127.23 });
|
||||
is $double * 1, 127.23, 'numerification';
|
||||
is "$double", "127.23", 'stringification';
|
||||
|
||||
ok $double->isa('SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType'), 'inheritance';
|
||||
|
||||
# TODO test range
|
||||
@@ -1,12 +0,0 @@
|
||||
use Test::More tests => 4;
|
||||
use strict;
|
||||
use warnings;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::float;
|
||||
my $float = SOAP::WSDL::XSD::Typelib::Builtin::float->new();
|
||||
ok $float = SOAP::WSDL::XSD::Typelib::Builtin::float->new({ value => 127.23 });
|
||||
is $float * 1, 127.23, 'numerification';
|
||||
is "$float", "127.23", 'stringification';
|
||||
|
||||
ok $float->isa('SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType'), 'inheritance';
|
||||
|
||||
# TODO test range
|
||||
@@ -1,11 +0,0 @@
|
||||
use Test::More tests => 5;
|
||||
use strict;
|
||||
use warnings;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::hexBinary;
|
||||
my $hexBinary = SOAP::WSDL::XSD::Typelib::Builtin::hexBinary->new();
|
||||
is $hexBinary->get_value(), undef;
|
||||
$hexBinary = SOAP::WSDL::XSD::Typelib::Builtin::hexBinary->new({});
|
||||
is $hexBinary->get_value(), undef;
|
||||
ok $hexBinary = SOAP::WSDL::XSD::Typelib::Builtin::hexBinary->new({ value => 'a1b2c3d4' });
|
||||
is "$hexBinary", "a1b2c3d4", 'stringification';
|
||||
ok $hexBinary->isa('SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType'), 'inheritance';
|
||||
@@ -1,12 +0,0 @@
|
||||
use Test::More tests => 6;
|
||||
use strict;
|
||||
use warnings;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::int;
|
||||
my $int = SOAP::WSDL::XSD::Typelib::Builtin::int->new();
|
||||
ok defined $int;
|
||||
ok $int->set_value('127');
|
||||
ok $int = SOAP::WSDL::XSD::Typelib::Builtin::int->new({ value => 127 });
|
||||
is $int * 1, 127, 'numerification';
|
||||
is "$int", "127", 'stringification';
|
||||
|
||||
ok $int->isa('SOAP::WSDL::XSD::Typelib::Builtin::long'), 'inheritance';
|
||||
@@ -1,13 +0,0 @@
|
||||
use Test::More tests => 6;
|
||||
use strict;
|
||||
use warnings;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::integer;
|
||||
my $integer = SOAP::WSDL::XSD::Typelib::Builtin::integer->new();
|
||||
is $integer->get_value(), undef;
|
||||
$integer = SOAP::WSDL::XSD::Typelib::Builtin::integer->new({});
|
||||
is $integer->get_value(), undef;
|
||||
ok $integer = SOAP::WSDL::XSD::Typelib::Builtin::integer->new({ value => 127 });
|
||||
is $integer * 1, 127, 'numerification';
|
||||
is "$integer", "127", 'stringification';
|
||||
|
||||
ok $integer->isa('SOAP::WSDL::XSD::Typelib::Builtin::decimal'), 'inheritance';
|
||||
@@ -1,12 +0,0 @@
|
||||
use Test::More tests => 5;
|
||||
use strict;
|
||||
use warnings;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::language;
|
||||
my $Name = SOAP::WSDL::XSD::Typelib::Builtin::language->new();
|
||||
is $Name->get_value(), undef;
|
||||
$Name = SOAP::WSDL::XSD::Typelib::Builtin::language->new({});
|
||||
is $Name->get_value(), undef;
|
||||
ok $Name = SOAP::WSDL::XSD::Typelib::Builtin::language->new({ value => 'DE' });
|
||||
is "$Name", "DE", 'stringification';
|
||||
|
||||
ok $Name->isa('SOAP::WSDL::XSD::Typelib::Builtin::token'), 'inheritance';
|
||||
@@ -1,28 +0,0 @@
|
||||
package ListTest;
|
||||
use base qw(SOAP::WSDL::XSD::Typelib::Builtin::list
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::string);
|
||||
|
||||
package main;
|
||||
use Test::More tests => 11;
|
||||
use strict;
|
||||
use warnings;
|
||||
my $obj = ListTest->new();
|
||||
is $obj->get_value(), undef;
|
||||
$obj = ListTest->new({});
|
||||
is $obj->get_value(), undef;
|
||||
ok $obj = ListTest->new({ value => 'Test' });
|
||||
is "$obj", 'Test', 'stringification';
|
||||
|
||||
ok $obj->isa('SOAP::WSDL::XSD::Typelib::Builtin::string'), 'inheritance';
|
||||
|
||||
$obj->set_value(undef);
|
||||
is $obj->get_value, undef;
|
||||
is $obj->serialize(), '', 'serialize undef to empty string';
|
||||
is $obj->serialize({ empty => 1 }), '', 'serialize undef to empty string';
|
||||
|
||||
$obj->set_value(42);
|
||||
is $obj->get_value, 42;
|
||||
is $obj->serialize(), '42', 'serialize undef to empty string';
|
||||
|
||||
$obj->set_value([1,2,3]);
|
||||
is $obj->serialize(), '1 2 3', 'list serialization';
|
||||
@@ -1,12 +0,0 @@
|
||||
use Test::More tests => 6;
|
||||
use strict;
|
||||
use warnings;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::long;
|
||||
my $long = SOAP::WSDL::XSD::Typelib::Builtin::long->new();
|
||||
ok defined $long;
|
||||
ok $long->set_value('127');
|
||||
ok $long = SOAP::WSDL::XSD::Typelib::Builtin::long->new({ value => 127 });
|
||||
is $long * 1, 127, 'numerification';
|
||||
is "$long", "127", 'stringification';
|
||||
|
||||
ok $long->isa('SOAP::WSDL::XSD::Typelib::Builtin::decimal'), 'inheritance';
|
||||
@@ -1,10 +0,0 @@
|
||||
use Test::More tests => 4;
|
||||
use strict;
|
||||
use warnings;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::negativeInteger;
|
||||
my $negativeInteger = SOAP::WSDL::XSD::Typelib::Builtin::negativeInteger->new();
|
||||
ok $negativeInteger = SOAP::WSDL::XSD::Typelib::Builtin::negativeInteger->new({ value => 127 });
|
||||
is $negativeInteger * 1, 127, 'numerification';
|
||||
is "$negativeInteger", "127", 'stringification';
|
||||
|
||||
ok $negativeInteger->isa('SOAP::WSDL::XSD::Typelib::Builtin::nonPositiveInteger'), 'inheritance';
|
||||
@@ -1,10 +0,0 @@
|
||||
use Test::More tests => 4;
|
||||
use strict;
|
||||
use warnings;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::nonNegativeInteger;
|
||||
my $nonNegativeInteger = SOAP::WSDL::XSD::Typelib::Builtin::nonNegativeInteger->new();
|
||||
ok $nonNegativeInteger = SOAP::WSDL::XSD::Typelib::Builtin::nonNegativeInteger->new({ value => 127 });
|
||||
is $nonNegativeInteger * 1, 127, 'numerification';
|
||||
is "$nonNegativeInteger", "127", 'stringification';
|
||||
|
||||
ok $nonNegativeInteger->isa('SOAP::WSDL::XSD::Typelib::Builtin::integer'), 'inheritance';
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user