import SOAP-WSDL 2.00_17 from CPAN

git-cpan-module:   SOAP-WSDL
git-cpan-version:  2.00_17
git-cpan-authorid: MKUTTER
git-cpan-file:     authors/id/M/MK/MKUTTER/SOAP-WSDL-2.00_17.tar.gz
This commit is contained in:
Martin Kutter
2007-10-05 09:50:09 -08:00
committed by Michael G. Schwern
parent c6a48ba84b
commit 008d06b72a
319 changed files with 23045 additions and 2383 deletions

38
t/001_use.t Normal file
View File

@@ -0,0 +1,38 @@
#!/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::SOAP11
SOAP::WSDL::Deserializer::SOAP11
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");
}

332
t/002_parse_wsdl.t Normal file
View File

@@ -0,0 +1,332 @@
#!/usr/bin/perl -w
use strict;
use warnings;
use Test::More tests => 17;
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 => { 'urn:myNamespace' => 'tns',
"http://www.w3.org/2001/XMLSchema" => 'xsd' },
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;
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>
};
}

View File

@@ -0,0 +1,96 @@
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"
);

398
t/004_parse_wsdl.t Normal file
View File

@@ -0,0 +1,398 @@
#!/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 => { 'http://www.example.org/MessageGateway2/' => 'tns',
'http://www.w3.org/2001/XMLSchema' => 'xsd',
'http://schemas.xmlsoap.org/wsdl/' => '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>};
}

24
t/005_parse_contributed.t Normal file
View File

@@ -0,0 +1,24 @@
#!/usr/bin/perl -w
use strict;
use warnings;
use Test::More qw(no_plan);
use lib '../lib';
use File::Basename qw(dirname);
use_ok(qw/SOAP::WSDL::Expat::WSDLParser/);
my $parser;
ok($parser = SOAP::WSDL::Expat::WSDLParser->new(), "Object creation");
eval { $parser->parse_file( dirname(__FILE__) .'/contributed.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");

112
t/006_client.t Normal file
View File

@@ -0,0 +1,112 @@
#!/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
readable => 1,
)->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 );
};
ok ! $@;

36
t/007_envelope.t Normal file
View File

@@ -0,0 +1,36 @@
#!/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::SOAP11/;
my $opt = {
readable => 1,
namespace => {
},
};
my $xml;
ok( $xml = SOAP::WSDL::Serializer::SOAP11->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' );
}

View File

@@ -0,0 +1,30 @@
#!/usr/bin/perl -w
use strict;
use warnings;
use Test::More qw/no_plan/; # TODO: change to tests => N;
use lib '../lib';
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/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";

89
t/009_data_classes.t Normal file
View File

@@ -0,0 +1,89 @@
#!/usr/bin/perl -w
use strict;
use warnings;
use Test::More tests => 6;
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;
my $path = cwd;
$path =~s|\/t\/?$||; # allow running from t/ and above (Build test)
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(
readable => 1,
wsdl => 'file:///' . $path .'/t/acceptance/wsdl/006_sax_client.wsdl',
)->wsdlinit();
$soap->servicename('MessageGateway');
ok( $soap->no_dispatch( 1 ) , "Set no_dispatch" );
ok( $soap->readable( 0 ) , "Set readable");
sub xml {
q{<SOAP-ENV:Envelope
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_class {
my $name = join('/', @{ $_[1] });
return ($class_list{ $name }) ? $class_list{ $name }
: warn "no class found for $name";
};
};
};

36
t/011_simpleType.t Normal file
View File

@@ -0,0 +1,36 @@
#!/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, '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';

68
t/012_element.t Normal file
View File

@@ -0,0 +1,68 @@
#!/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, '<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, '<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, '<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';

48
t/013_complexType.t Normal file
View File

@@ -0,0 +1,48 @@
#!/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::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__

63
t/016_client_object.t Normal file
View File

@@ -0,0 +1,63 @@
#!/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] };
}

442
t/017_generator.t Normal file
View File

@@ -0,0 +1,442 @@
#!/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,
});
eval { $message_parser->parse_string( xml_message2() ) };
ok ( !$@, 'parse XML message: ' . $@);
TODO: {
local $TODO = 'support embedded atomic simpleType/complexType definitions';
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>};
}

View File

@@ -0,0 +1,7 @@
use Test::More tests => 2;
use lib 't/lib';
use lib 'lib';
use_ok q(MyInterfaces::GlobalWeather);
ok MyInterfaces::GlobalWeather->new();

10
t/020_storable.t Normal file
View File

@@ -0,0 +1,10 @@
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';

19
t/098_pod.t Normal file
View File

@@ -0,0 +1,19 @@
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 )
}

View File

@@ -1,107 +0,0 @@
#!/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";
}

View File

@@ -1,104 +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 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";
};
};

View File

@@ -1,109 +0,0 @@
#!/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";

View File

@@ -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 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");

View File

@@ -1,19 +0,0 @@
# 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;

View File

@@ -1,27 +0,0 @@
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 )
}

View File

@@ -1,27 +0,0 @@
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( $_ );
}

52
t/Expat/01_expat.t Normal file
View File

@@ -0,0 +1,52 @@
#!/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>
</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',
);
sub new { return bless {}, 'FakeResolver' };
sub get_class {
my $name = join('/', @{ $_[1] });
return ($class_list{ $name }) ? $class_list{ $name }
: warn "no class found for $name";
};
};
};

410
t/Expat/03_wsdl.t Normal file
View File

@@ -0,0 +1,410 @@
#!/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()->{ 'http://www.example.org/MessageGateway2/' }, 'tns', 'Namespace definition';
my $opt = {
typelib => $wsdl->first_types,
readable => 1,
autotype => 0,
namespace => { 'http://www.example.org/MessageGateway2/' => 'tns',
'http://www.w3.org/2001/XMLSchema' => 'xsd',
'http://schemas.xmlsoap.org/wsdl/' => '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>};
}

7
t/SOAP/WSDL/01_use.t Normal file
View File

@@ -0,0 +1,7 @@
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';

25
t/SOAP/WSDL/02_port.t Normal file
View File

@@ -0,0 +1,25 @@
use Test::More tests => 7;
use strict;
use warnings;
use diagnostics;
use Cwd;
use File::Basename;
use File::Spec;
use lib '../lib';
use_ok(qw/SOAP::WSDL/);
my $path = File::Spec->rel2abs( dirname __FILE__ );
my $soap;
#2
ok( $soap = SOAP::WSDL->new(
wsdl => 'file:///' . $path . '/../../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');

View File

@@ -0,0 +1,80 @@
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__ );
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://' . $path . '/../../acceptance/wsdl/03_complexType-all.wsdl',
readable =>1,
), '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)');
}

View File

@@ -0,0 +1,12 @@
use Test::More tests => 2;
use lib '../lib';
use_ok qw/SOAP::WSDL/;
my $soap = SOAP::WSDL->new();
TODO: {
local $TODO="implement <choice> support";
fail "serialize choice element";
}

View File

@@ -0,0 +1,22 @@
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> support";
fail "serialize complexContent element";
}

View File

@@ -0,0 +1,39 @@
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 $xml;
my $soap;
#2
ok( $soap = SOAP::WSDL->new(
wsdl => 'file://' . $path . '/../../acceptance/wsdl/03_complexType-element-ref.wsdl',
readable => 1,
no_dispatch => 1,
), 'Instantiated object' );
# 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' );
is $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><testAll><TestRef>TestRef</TestRef><Test2>Test2</Test2></testAll></SOAP-ENV:Body></SOAP-ENV:Envelope>}
, 'element ref="" serialization';

View File

@@ -0,0 +1,22 @@
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";
}

View File

@@ -0,0 +1,76 @@
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__ );
#2
ok( $soap = SOAP::WSDL->new(
wsdl => 'file://' . $path . '/../../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"
);
};

View File

@@ -0,0 +1,22 @@
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";
}

View File

@@ -0,0 +1,4 @@
use Test::More skip_all => 'TODO: implement tests';
use lib '../lib';

View File

@@ -0,0 +1,48 @@
use Test::More tests => 6;
use strict;
use warnings;
use lib '../lib';
use lib 't/lib';
use File::Basename;
use File::Spec;
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 . '/../../acceptance/wsdl/04_element-simpleType.wsdl'
), 'Instantiated object' );
#3
$soap->readable(1);
# won't work without - would require SOAP::WSDL::Deserializer::SOM,
# which requires SOAP::Lite
$soap->outputxml(1);
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)';
}

66
t/SOAP/WSDL/04_element.t Normal file
View File

@@ -0,0 +1,66 @@
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__ );
#2
ok( $soap = SOAP::WSDL->new(
wsdl => 'file://' . $path . '/../../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' );
is $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><testElementRef xmlns="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)');
}

View File

@@ -0,0 +1,51 @@
use Test::More tests => 8;
use strict;
use lib '../lib';
use lib 't/lib';
use File::Spec;
use File::Basename;
use_ok(qw/SOAP::WSDL/);
my ($soap, $xml, $xml2);
# chdir to my location
my $path = File::Spec->rel2abs( dirname __FILE__ );
#2
ok( $soap = SOAP::WSDL->new(
wsdl => 'file:///' . $path . '/../../acceptance/wsdl/05_simpleType-list.wsdl'
), 'Instantiated object' );
$soap->readable(1);
# won't work without - would require SOAP::WSDL::Deserializer::SOM,
# which requires SOAP::Lite
$soap->outputxml(1);
#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)');
}

View File

@@ -0,0 +1,57 @@
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_ok(qw/SOAP::WSDL/);
my $xml;
my $path = File::Spec->rel2abs( dirname __FILE__ );
my $soap;
#2
ok( $soap = SOAP::WSDL->new(
wsdl => 'file:///' . $path . '/../../acceptance/wsdl/05_simpleType-restriction.wsdl'
), 'Instantiated object' );
#3
$soap->readable(1);
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');
}

View File

@@ -0,0 +1,62 @@
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
$soap->readable(1);
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)');

View File

@@ -0,0 +1,30 @@
use Test::More tests => 6;
use strict;
use warnings;
use diagnostics;
use Cwd;
use File::Basename;
use File::Spec;
use lib '../lib';
use_ok(qw/SOAP::WSDL/);
my $path = File::Spec->rel2abs( dirname __FILE__ );
my $soap;
#2
ok( $soap = SOAP::WSDL->new(
wsdl => 'file:///' . $path . '/../../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';

View File

@@ -0,0 +1,53 @@
#!/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::Spec;
use File::Basename;
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;
my $path = File::Spec->rel2abs( dirname __FILE__ );
ok $soap = SOAP::WSDL->new(
wsdl => 'file:///'.$path.'/../../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';

25
t/SOAP/WSDL/12_binding.t Normal file
View File

@@ -0,0 +1,25 @@
use strict;
use lib '../../../lib';
use Test::More tests => 4;
use SOAP::WSDL;
use File::Spec;
use Data::Dumper;
use File::Basename;
print "# Using SOAP::WSDL Version $SOAP::WSDL::VERSION\n";
# chdir to my location
my $soap = undef;
my $path = File::Spec->rel2abs( dirname __FILE__ );
my $url = 'http://127.0.0.1/testPort';
ok( $soap = SOAP::WSDL->new(
wsdl => 'file:///' . $path . '/../../acceptance/wsdl/02_port.wsdl'
) );
ok $soap->wsdlinit( url => $url );
ok $soap->servicename('testService');
ok $soap->portname('testPort');

View File

@@ -0,0 +1,21 @@
use Test::More tests => 11;
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;
ok $data = $deserializer->deserialize(q{<a><b><c>1</c></b><b><c>2</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');

View File

@@ -0,0 +1,30 @@
use Test::More;
eval { require SOAP::Lite } or do {
plan skip_all => 'SOAP::Lite not available';
exit 0;
};
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;
is $data->{ b }->[0] , 1;
is $data->{ b }->[1] , 2;
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';

View File

@@ -0,0 +1,19 @@
use strict;
use warnings;
use Test::More tests => 5;
use SOAP::WSDL::Deserializer::SOAP11;
my $obj;
ok $obj = SOAP::WSDL::Deserializer::SOAP11->new();
ok $obj = SOAP::WSDL::Deserializer::SOAP11->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';

View File

@@ -0,0 +1,21 @@
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};

View File

@@ -0,0 +1,21 @@
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};

View File

@@ -0,0 +1,16 @@
use strict;
use warnings;
use Test::More tests => 4;
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};

View File

@@ -0,0 +1,63 @@
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_interface({
NO_POD => 1,
output => \$output,
});
ok eval $output;
$output = q{};
$generator->generate_typemap({
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;
};

View File

@@ -0,0 +1,22 @@
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();

View File

@@ -0,0 +1,144 @@
use strict;
use warnings;
use Test::More tests => 5;
use File::Basename;
use File::Spec;
my $path = File::Spec->rel2abs( dirname __FILE__ );
use_ok qw(SOAP::WSDL::Generator::Visitor::Typemap);
my $visitor;
ok $visitor = SOAP::WSDL::Generator::Visitor::Typemap->new(), 'constructor';
use SOAP::WSDL::Expat::WSDLParser;
my $parser = SOAP::WSDL::Expat::WSDLParser->new();
$parser->parse_file(
$path . '/../../../../acceptance/wsdl/'
#. '04_element.wsdl'
#. '11_helloworld.wsdl'
#. '008_complexType.wsdl'
. '006_sax_client.wsdl'
);
my $definitions = $parser->get_data();
$definitions->_accept( $visitor );
#use Data::Dumper;
#print Dumper $visitor->get_typemap();
my $typemap = $visitor->get_typemap();
is $typemap->{'EnqueueMessage/MMessage/MKeepalive'}, 'MyTypes::TKeepalive', 'content';
is $typemap->{'EnqueueMessageResponse'}, 'MyTypes::TMessageID', 'content';
is $typemap->{'KeepaliveMessageResponse'}, 'MyTypes::TMessageID', 'content';
sub wsdl {
q{<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:s0="urn:HelloWorld"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="urn:HelloWorld"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<s:schema elementFormDefault="qualified"
targetNamespace="urn:HelloWorld">
<s:element name="sayHello">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="name"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="givenName"
type="s:string" nillable="1"/>
<!-- <s:element minOccurs="0" maxOccurs="1" name="test"
type="s0:test2" /> //-->
</s:sequence>
</s:complexType>
</s:element>
<s:element name="sayHelloResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1"
name="sayHelloResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="test2">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="name"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="givenName"
type="s:string" />
</s:sequence>
</s:complexType>
<s:complexType name="testExtended">
<s:extension base="s0:test2">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="extend"
type="s:string" />
</s:sequence>
</s:extension>
</s:complexType>
</s:schema>
</types>
<message name="sayHelloSoapIn">
<part name="parameters" element="s0:sayHello" />
<!-- <part name="test1" type="s0:testExtended" />
<part name="test2" type="s0:test2"
targetNamespace="urn:test2" /> //-->
</message>
<message name="sayHelloSoapOut">
<part name="parameters" element="s0:sayHelloResponse" />
</message>
<portType name="Service1Soap">
<operation name="sayHello">
<input message="s0:sayHelloSoapIn" />
<output message="s0:sayHelloSoapOut" />
</operation>
</portType>
<binding name="Service1Soap" type="s0:Service1Soap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
<operation name="sayHello">
<soap:operation soapAction="urn:HelloWorld#sayHello"
style="document" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
<service name="Service1">
<port name="Service1Soap" binding="s0:Service1Soap">
<soap:address
location="http://helloworld/helloworld.asmx" />
</port>
</service>
</definitions>
}
}

111
t/SOAP/WSDL/Generator/XSD.t Normal file
View File

@@ -0,0 +1,111 @@
use Test::More tests => 26;
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_typelib();
$generator->generate_typemap();
$generator->generate_interface();
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';
rmtree "$path/testlib";

View File

@@ -0,0 +1,24 @@
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 $@;

View File

@@ -0,0 +1,47 @@
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');
ok( $soap->get_transport->set_base_dir( join '/', $base_dir, 'acceptance' ) );
{
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';
}

View File

@@ -0,0 +1,20 @@
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');
$transport->send_receive(envelope => 'Test', action => 'foo');
ok ! $transport->is_success();
$transport->send_receive(encoding => 'utf8', envelope => 'ÄÖÜ',
action => 'foo');
ok ! $transport->is_success();

View File

@@ -0,0 +1 @@
test2

View File

@@ -0,0 +1 @@
<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>

View File

@@ -0,0 +1,22 @@
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';

View File

@@ -0,0 +1,104 @@
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;
}

View File

@@ -0,0 +1,12 @@
use Test::More tests => 5;
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 = 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';
ok $ENTITY->isa('SOAP::WSDL::XSD::Typelib::Builtin::NCName'), 'inheritance';

View File

@@ -0,0 +1,12 @@
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';

View File

@@ -0,0 +1,12 @@
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';

View File

@@ -0,0 +1,16 @@
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", "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';

View File

@@ -0,0 +1,12 @@
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';

View File

@@ -0,0 +1,12 @@
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';

View File

@@ -0,0 +1,21 @@
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", '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", q{}, 'stringification';
ok $NMTOKENS->isa('SOAP::WSDL::XSD::Typelib::Builtin::NMTOKEN'), 'inheritance';
ok $NMTOKENS->isa('SOAP::WSDL::XSD::Typelib::Builtin::list'), 'inheritance';

View File

@@ -0,0 +1,12 @@
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';

View File

@@ -0,0 +1,12 @@
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';

View File

@@ -0,0 +1,50 @@
use strict;
use warnings;
use Test::More tests => 20;
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();
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}, 'serialize 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';
is "$obj", 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';

View File

@@ -0,0 +1,23 @@
use strict;
use warnings;
use Test::More tests => 7;
use Scalar::Util qw(blessed);
use lib '../../../../../../lib';
use_ok qw(SOAP::WSDL::XSD::Typelib::Builtin::anyType);
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';

View File

@@ -0,0 +1,14 @@
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';

View File

@@ -0,0 +1,12 @@
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();
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';

View File

@@ -0,0 +1,51 @@
use Test::More tests => 18;
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", 'true', 'stringification';
$bool->set_value('1');
is $bool, 'true';
$bool ? pass 'boolification' : fail 'boolification';
$bool->set_value('0');
is $bool, 'false';
! $bool ? pass 'boolification' : fail 'boolification';
$bool->set_value(undef);
is $bool, 'false';
! $bool ? pass 'boolification' : fail 'boolification';
$bool->set_value('false');
if ($bool) {
fail 'boolification';
}
else {
pass 'boolification';
}
is "$bool", 'false', 'stringification';
ok $bool->isa('SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType'), 'inheritance';
is $bool->serialize({ name => 'test'}), '<test >false</test >';
$bool->delete_value();
is "$bool", '', 'serialized undef to empty string';

View File

@@ -0,0 +1,12 @@
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';

View File

@@ -0,0 +1,74 @@
use Test::More tests => 30;
use strict;
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',
);
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';

View File

@@ -0,0 +1,32 @@
use Test::More tests => 4;
use strict;
use warnings;
use lib '../lib';
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',
);
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');

View File

@@ -0,0 +1,15 @@
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)

View File

@@ -0,0 +1,13 @@
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

View File

@@ -0,0 +1,12 @@
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

View File

@@ -0,0 +1,11 @@
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';

View File

@@ -0,0 +1,12 @@
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';

View File

@@ -0,0 +1,13 @@
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';

View File

@@ -0,0 +1,12 @@
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';

View File

@@ -0,0 +1,10 @@
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';

View File

@@ -0,0 +1,10 @@
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';

View File

@@ -0,0 +1,10 @@
use Test::More tests => 4;
use strict;
use warnings;
use SOAP::WSDL::XSD::Typelib::Builtin::nonPositiveInteger;
my $nonPositiveInteger = SOAP::WSDL::XSD::Typelib::Builtin::nonPositiveInteger->new();
ok $nonPositiveInteger = SOAP::WSDL::XSD::Typelib::Builtin::nonPositiveInteger->new({ value => 127 });
is $nonPositiveInteger * 1, 127, 'numerification';
is "$nonPositiveInteger", "127", 'stringification';
ok $nonPositiveInteger->isa('SOAP::WSDL::XSD::Typelib::Builtin::integer'), 'inheritance';

View File

@@ -0,0 +1,22 @@
use Test::More tests => 8;
use strict;
use warnings;
use SOAP::WSDL::XSD::Typelib::Builtin::normalizedString;
my $obj = SOAP::WSDL::XSD::Typelib::Builtin::normalizedString->new();
is $obj->get_value(), undef;
$obj = SOAP::WSDL::XSD::Typelib::Builtin::normalizedString->new({});
is $obj->get_value(), undef;
ok $obj = SOAP::WSDL::XSD::Typelib::Builtin::normalizedString->new({ value => 'Test' });
is "$obj", 'Test', 'stringification';
ok $obj->isa('SOAP::WSDL::XSD::Typelib::Builtin::string'), 'inheritance';
$obj->set_value( "&\t\"Aber\"\n\r<test>");
is $obj->get_value() , '& "Aber" <test>';
is $obj, '&amp; &qout;Aber&qout; &lt;test&gt;'
, 'escape text on serialization';
is $obj->serialize({ name => 'test'})
, '<test >&amp; &qout;Aber&qout; &lt;test&gt;</test >'
, 'Serialization with name';

View File

@@ -0,0 +1,10 @@
use Test::More tests => 4;
use strict;
use warnings;
use SOAP::WSDL::XSD::Typelib::Builtin::positiveInteger;
my $positiveInteger = SOAP::WSDL::XSD::Typelib::Builtin::positiveInteger->new();
ok $positiveInteger = SOAP::WSDL::XSD::Typelib::Builtin::positiveInteger->new({ value => 127 });
is $positiveInteger * 1, 127, 'numerification';
is "$positiveInteger", "127", 'stringification';
ok $positiveInteger->isa('SOAP::WSDL::XSD::Typelib::Builtin::nonNegativeInteger'), 'inheritance';

View File

@@ -0,0 +1,12 @@
use Test::More tests => 6;
use strict;
use warnings;
use SOAP::WSDL::XSD::Typelib::Builtin::short;
my $short = SOAP::WSDL::XSD::Typelib::Builtin::short->new();
ok defined $short;
ok $short->set_value('127');
ok $short = SOAP::WSDL::XSD::Typelib::Builtin::short->new({ value => 127 });
is $short * 1, 127, 'numerification';
is "$short", "127", 'stringification';
ok $short->isa('SOAP::WSDL::XSD::Typelib::Builtin::int'), 'inheritance';

View File

@@ -0,0 +1,23 @@
use Test::More tests => 5;
use strict;
use warnings;
use lib '../lib';
use_ok('SOAP::WSDL::XSD::Typelib::Builtin::string');
my $obj;
$obj = SOAP::WSDL::XSD::Typelib::Builtin::string->new({ value => '& "Aber" <test>'});
is $obj, '&amp; &qout;Aber&qout; &lt;test&gt;'
, 'escape text on serialization';
$obj = SOAP::WSDL::XSD::Typelib::Builtin::string->new();
$obj = SOAP::WSDL::XSD::Typelib::Builtin::string->new({});
$obj->set_value( '& "Aber" <test>');
is $obj->get_value() , '& "Aber" <test>';
is $obj, '&amp; &qout;Aber&qout; &lt;test&gt;'
, 'escape text on serialization';
is $obj->serialize({ name => 'test'})
, '<test >&amp; &qout;Aber&qout; &lt;test&gt;</test >'
, 'Serialization with name';

View File

@@ -0,0 +1,25 @@
use Test::More tests => 3;
use strict;
use warnings;
use lib '../lib';
use_ok('SOAP::WSDL::XSD::Typelib::Builtin::time');
my $obj;
$obj = SOAP::WSDL::XSD::Typelib::Builtin::time->new();
$obj->set_value( '12:23:03' );
is $obj->get_value() , '12:23:03+01:00', 'conversion';
$obj->set_value( '12:23:03.12345+01:00' ), ;
is $obj->get_value() , '12:23:03.12345+01:00', 'no conversion';
# exit;
#~ use Benchmark;
#~ timethese 10000, {
#~ xml => sub { $obj->set_value('2037-12-31T00:00:00.0000000+01:00') },
#~ string => sub { $obj->set_value('2037-12-31') },
#~ }

View File

@@ -0,0 +1,12 @@
use Test::More tests => 5;
use strict;
use warnings;
use SOAP::WSDL::XSD::Typelib::Builtin::NMTOKEN;
my $NMTOKEN = SOAP::WSDL::XSD::Typelib::Builtin::NMTOKEN->new();
is $NMTOKEN->get_value(), undef;
$NMTOKEN = SOAP::WSDL::XSD::Typelib::Builtin::NMTOKEN->new({});
is $NMTOKEN->get_value(), undef;
ok $NMTOKEN = SOAP::WSDL::XSD::Typelib::Builtin::NMTOKEN->new({ value => 127 });
is "$NMTOKEN", "127", 'stringification';
ok $NMTOKEN->isa('SOAP::WSDL::XSD::Typelib::Builtin::token'), 'inheritance';

View File

@@ -0,0 +1,12 @@
use Test::More tests => 6;
use strict;
use warnings;
use SOAP::WSDL::XSD::Typelib::Builtin::unsignedByte;
my $unsignedByte = SOAP::WSDL::XSD::Typelib::Builtin::unsignedByte->new();
ok defined $unsignedByte;
ok $unsignedByte->set_value('127');
ok $unsignedByte = SOAP::WSDL::XSD::Typelib::Builtin::unsignedByte->new({ value => 127 });
is $unsignedByte * 1, 127, 'numerification';
is "$unsignedByte", "127", 'stringification';
ok $unsignedByte->isa('SOAP::WSDL::XSD::Typelib::Builtin::nonNegativeInteger'), 'inheritance';

View File

@@ -0,0 +1,12 @@
use Test::More tests => 6;
use strict;
use warnings;
use SOAP::WSDL::XSD::Typelib::Builtin::unsignedInt;
my $unsignedInt = SOAP::WSDL::XSD::Typelib::Builtin::unsignedInt->new();
ok defined $unsignedInt;
ok $unsignedInt->set_value('127');
ok $unsignedInt = SOAP::WSDL::XSD::Typelib::Builtin::unsignedInt->new({ value => 127 });
is $unsignedInt * 1, 127, 'numerification';
is "$unsignedInt", "127", 'stringification';
ok $unsignedInt->isa('SOAP::WSDL::XSD::Typelib::Builtin::nonNegativeInteger'), 'inheritance';

View File

@@ -0,0 +1,12 @@
use Test::More tests => 6;
use strict;
use warnings;
use SOAP::WSDL::XSD::Typelib::Builtin::unsignedLong;
my $unsignedLong = SOAP::WSDL::XSD::Typelib::Builtin::unsignedLong->new();
ok defined $unsignedLong;
ok $unsignedLong->set_value('127');
ok $unsignedLong = SOAP::WSDL::XSD::Typelib::Builtin::unsignedLong->new({ value => 127 });
is $unsignedLong * 1, 127, 'numerification';
is "$unsignedLong", "127", 'stringification';
ok $unsignedLong->isa('SOAP::WSDL::XSD::Typelib::Builtin::nonNegativeInteger'), 'inheritance';

View File

@@ -0,0 +1,12 @@
use Test::More tests => 6;
use strict;
use warnings;
use SOAP::WSDL::XSD::Typelib::Builtin::unsignedShort;
my $unsignedShort = SOAP::WSDL::XSD::Typelib::Builtin::unsignedShort->new();
ok defined $unsignedShort;
ok $unsignedShort->set_value('127');
ok $unsignedShort = SOAP::WSDL::XSD::Typelib::Builtin::unsignedShort->new({ value => 127 });
is $unsignedShort * 1, 127, 'numerification';
is "$unsignedShort", "127", 'stringification';
ok $unsignedShort->isa('SOAP::WSDL::XSD::Typelib::Builtin::nonNegativeInteger'), 'inheritance';

View File

@@ -1,180 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:s0="urn:HelloWorld"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="urn:HelloWorld"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<s:schema elementFormDefault="qualified"
targetNamespace="urn:HelloWorld">
<s:element name="sayHello">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="name"
type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="sayGoodBye">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="name"
type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="sayHelloResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="sayHelloResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="sayGoodByeResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="sayGoodByeResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="contact_detail_list">
<s:complexContent>
<s:restriction base="soapenc:Array">
<s:attribute ref="soapenc:arrayType" wsdl:arrayType="s0:person_detail[]"/>
</s:restriction>
</s:complexContent>
</s:complexType>
<s:complexType name="person_detail">
<s:all>
<s:element name="email_address" type="s:string"/>
<s:element name="user_name" type="s:string"/>
<s:element name="first_name" type="s:string"/>
<s:element name="last_name" type="s:string"/>
<s:element name="department" type="s:string"/>
<s:element name="id" type="s:string"/>
<s:element name="title" type="s:string"/>
</s:all>
</s:complexType>
</s:schema>
</types>
<message name="sayHelloSoapIn">
<part name="parameters" element="s0:sayHello" />
</message>
<message name="sayGoodByeSoapIn">
<part name="parameters" element="s0:sayHello" />
</message>
<message name="sayGoodByeSoapInSecond">
</message>
<message name="sayGoodByeSoapInThird">
<part name="name" type="s:string" />
<part name="recipients" type="s0:contact_detail_list" />
</message>
<message name="sayHelloSoapOut">
<part name="parameters" element="s0:sayGoodByeResponse" />
</message>
<message name="sayGoodByeSoapOut">
<part name="parameters" element="s0:sayGoodByeResponse" />
</message>
<portType name="Service1Soap">
<operation name="sayHello">
<input message="s0:sayHelloSoapIn" />
<output message="s0:sayHelloSoapOut" />
</operation>
</portType>
<portType name="Service2Soap">
<operation name="sayGoodBye">
<input message="s0:sayGoodByeSoapIn" />
<output message="s0:sayGoodByeSoapOut" />
</operation>
<operation name="sayGoodByeOverload">
<input message="s0:sayGoodByeSoapIn" name="firstOverload" />
<output message="s0:sayGoodByeSoapOut" />
</operation>
<operation name="sayGoodByeOverload">
<input message="s0:sayGoodByeSoapInSecond" name="secondOverload" />
<output message="s0:sayGoodByeSoapOut" />
</operation>
<operation name="sayGoodByeOverload">
<input message="s0:sayGoodByeSoapInThird" name="thirdOverload" />
<output message="s0:sayGoodByeSoapOut" />
</operation>
</portType>
<binding name="Service1Soap" type="s0:Service1Soap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
<operation name="sayHello">
<soap:operation soapAction="urn:HelloWorld#sayHello"
style="document" />
<input>
<soap:body use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
<binding name="Service2Soap" type="s0:Service2Soap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
<operation name="sayGoodBye">
<soap:operation soapAction="urn:HelloWorld#sayGoodBye" style="document" />
<input>
<soap:body use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
<operation name="sayGoodByeOverload">
<soap:operation soapAction="urn:HelloWorld#sayGoodBye" style="document" />
<input>
<soap:body use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
</binding>
<service name="Service1">
<port name="Service1Soap" binding="s0:Service1Soap">
<soap:address
location="http://helloworld/helloworld.asmx" />
</port>
</service>
<service name="Service2">
<port name="Service2Soap" binding="s0:Service2Soap">
<soap:address
location="http://helloworld/helloworld.asmx" />
</port>
</service>
</definitions>

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd-WSDL="http://www.w3.org/1999/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="Test" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><test xmlns="Test"><testAll xsi:type="tns:testComplexType1"><Test1 xsi:type="xsd:string">Test 1</Test1><Test2 xsi:type="xsd:string">Test 2</Test2></testAll></test></SOAP-ENV:Body></SOAP-ENV:Envelope>

Some files were not shown because too many files have changed in this diff Show More