import SOAP-WSDL 2.00_06 from CPAN
git-cpan-module: SOAP-WSDL git-cpan-version: 2.00_06 git-cpan-authorid: MKUTTER git-cpan-file: authors/id/M/MK/MKUTTER/SOAP-WSDL-2.00_06.tar.gz
This commit is contained in:
committed by
Michael G. Schwern
parent
a78d6d15b5
commit
25548e6296
@@ -1,8 +1,7 @@
|
||||
#!/usr/bin/perl -w
|
||||
use strict;
|
||||
use warnings;
|
||||
use diagnostics;
|
||||
use Test::More tests => 17; # qw/no_plan/; # TODO: change to tests => N;
|
||||
use Test::More tests => 18; # qw/no_plan/; # TODO: change to tests => N;
|
||||
use lib '../lib';
|
||||
use XML::SAX::ParserFactory;
|
||||
|
||||
@@ -28,9 +27,9 @@ $parser->parse_string( xml() );
|
||||
my $wsdl;
|
||||
ok( $wsdl = $filter->get_data() , "get object tree");
|
||||
|
||||
# print Dumper $wsdl;
|
||||
|
||||
my $types = $wsdl->first_types();
|
||||
|
||||
is $types->get_parent(), $wsdl , 'types parent';
|
||||
|
||||
my $serializer_options = {
|
||||
readable => 1,
|
||||
|
||||
@@ -7,6 +7,7 @@ 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')
|
||||
@@ -20,10 +21,10 @@ ok $obj->isa('SOAP::WSDL::XSD::Typelib::Builtin::anyType')
|
||||
ok $obj->get_test->isa('SOAP::WSDL::XSD::Typelib::Builtin::string')
|
||||
, 'element isa';
|
||||
|
||||
is $obj, '<MyAtomicComplexTypeElement xmlns="urn:Test" ><MyTestElement >Test</MyTestElement>'
|
||||
. '<MyTestElement2 >Test2</MyTestElement2></MyAtomicComplexTypeElement>'
|
||||
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';
|
||||
@@ -33,12 +34,16 @@ ok $obj->isa('SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType')
|
||||
$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" ><MyTestElement >Test</MyTestElement>'
|
||||
. '<MyTestElement2 >Test2</MyTestElement2>'
|
||||
. '<MyTestElement2 >Test3</MyTestElement2>'
|
||||
is $obj, '<MyAtomicComplexTypeElement xmlns="urn:Test" ><test >Test</test>'
|
||||
. '<test2 >Test2</test2>'
|
||||
. '<test2 >Test3</test2>'
|
||||
. '</MyAtomicComplexTypeElement>'
|
||||
, 'multi value stringification';
|
||||
|
||||
|
||||
use diagnostics;
|
||||
|
||||
ok $obj = MyComplexTypeElement->new({ MyTestName => 'test' });
|
||||
is $obj, '<MyComplexTypeElement xmlns="urn:Test" ><MyTestName >test</MyTestName ></MyComplexTypeElement>';
|
||||
|
||||
__END__
|
||||
|
||||
|
||||
@@ -11,12 +11,12 @@ use_ok qw( MyComplexType );
|
||||
my $obj = MyComplexType->new({ MyTestName => 'test' });
|
||||
ok $obj->isa('SOAP::WSDL::XSD::Typelib::Builtin::anyType')
|
||||
, 'inherited class';
|
||||
is $obj, '<MyElementName >test</MyElementName>', 'stringification';
|
||||
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, '<MyElementName >test</MyElementName><MyElementName >test2</MyElementName>',
|
||||
is $obj, '<MyTestName >test</MyTestName ><MyTestName >test2</MyTestName >',
|
||||
'stringification';
|
||||
|
||||
# try on the fly factory
|
||||
@@ -35,7 +35,7 @@ is $obj, '<MyElementName >test</MyElementName><MyElementName >test2</MyElementNa
|
||||
$obj = MyComplexType2->new({ MyTestName => [ 'test', 'test2' ] });
|
||||
ok $obj->isa('SOAP::WSDL::XSD::Typelib::Builtin::anyType')
|
||||
, 'inherited class (on the fly-factory object)';
|
||||
is $obj, '<MyElementName >test</MyElementName><MyElementName >test2</MyElementName>',
|
||||
is $obj, '<MyTestName >test</MyTestName><MyTestName >test2</MyTestName>',
|
||||
'stringification (on the fly-factory object)';
|
||||
# print Dumper $obj->get_MyTestName();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/perl -w
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 5;
|
||||
use Test::More tests => 16;
|
||||
use lib '../lib';
|
||||
use XML::SAX::ParserFactory;
|
||||
|
||||
@@ -32,29 +32,42 @@ else
|
||||
{
|
||||
pass("parsing XML");
|
||||
}
|
||||
|
||||
|
||||
|
||||
my $TMessage;
|
||||
my $wsdl;
|
||||
ok( $wsdl = $filter->get_data() , "get object tree");
|
||||
|
||||
my %content;
|
||||
|
||||
for my $element (@{ $wsdl->first_types()->get_schema()->[1]->get_type() } ) {
|
||||
# print Dumper $element;
|
||||
local $SIG{__WARN__} = sub {
|
||||
like $_[0], qr{toClass \s is \s deprecated}xms, 'deprecated method warning';
|
||||
};
|
||||
my $output;
|
||||
$element->toClass({ prefix => 'MessageGateway', wsdl => $wsdl,
|
||||
$element->to_class({ prefix => 'MessageGateway::', wsdl => $wsdl,
|
||||
output => \$output
|
||||
});
|
||||
eval "$output";
|
||||
});
|
||||
|
||||
# skip eval'ing TMessage - it requires evalling other
|
||||
# types first
|
||||
if ($element->get_name() =~ m{\A (TMessage|TEnqueueMessage) \Z}xmsg ) {
|
||||
$content{$1} = $output;
|
||||
next;
|
||||
}
|
||||
my $name = 'MessageGateway::' . $element->get_name();
|
||||
ok eval $output, $name;
|
||||
|
||||
ok $name->can('serialize'), "$name\->can('serialize')";
|
||||
}
|
||||
|
||||
if ($@) {
|
||||
fail "evalling generated class";
|
||||
}
|
||||
else
|
||||
{
|
||||
pass "evalling generated class";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
|
||||
while ( my ($name, $code) = (each %content) ) {
|
||||
ok eval "$code", $name;
|
||||
}
|
||||
|
||||
ok MessageGateway::TMessage->can('serialize'), 'MessageGateway::TMessage->can("serialize")';
|
||||
ok MessageGateway::TEnqueueMessage->can('serialize'), "MessageGateway::TEnqueueMessage->can('serialize')";
|
||||
|
||||
sub xml {
|
||||
return q{<?xml version="1.0" encoding="UTF-8"?>
|
||||
<wsdl:definitions name="MessageGateway"
|
||||
@@ -302,7 +315,7 @@ sub xml {
|
||||
|
||||
<wsdl:portType name="MGWPortType">
|
||||
<wsdl:documentation>
|
||||
generic port type for all methods required for sending messages over the mosaic
|
||||
generic port type for all methods required for sending messages over the
|
||||
message gatewa
|
||||
</wsdl:documentation>
|
||||
<wsdl:operation name="EnqueueMessage">
|
||||
@@ -350,11 +363,11 @@ sub xml {
|
||||
</wsdl:binding>
|
||||
<wsdl:service name="MessageGateway">
|
||||
<wsdl:documentation>
|
||||
Web Service for sending messages over the mosaic message gatewa
|
||||
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 mosaic message gatewa</wsdl:documentation>
|
||||
<wsdl:documentation>HTTP(S) port for the message gatewa</wsdl:documentation>
|
||||
<soap:address location="https://www.example.org/MessageGateway/" />
|
||||
</wsdl:port>
|
||||
</wsdl:service>
|
||||
|
||||
@@ -20,8 +20,8 @@ ok $obj->isa('SOAP::WSDL::XSD::Typelib::Builtin::anyType')
|
||||
ok $obj->get_test->isa('SOAP::WSDL::XSD::Typelib::Builtin::string')
|
||||
, 'element isa';
|
||||
|
||||
is $obj, '<MyAtomicComplexTypeElement xmlns="urn:Test" ><MyTestElement >Test</MyTestElement>'
|
||||
. '<MyTestElement2 >Test2</MyTestElement2></MyAtomicComplexTypeElement>'
|
||||
is $obj, '<MyAtomicComplexTypeElement xmlns="urn:Test" ><test >Test</test>'
|
||||
. '<test2 >Test2</test2></MyAtomicComplexTypeElement>'
|
||||
, 'stringification';
|
||||
|
||||
my $soap = SOAP::WSDL::Client->new( {
|
||||
@@ -34,8 +34,8 @@ 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{<MyTestElement >Test</MyTestElement>}
|
||||
. q{<MyTestElement2 >Test2</MyTestElement2>}
|
||||
. q{<test >Test</test>}
|
||||
. q{<test2 >Test2</test2>}
|
||||
. q{</MyAtomicComplexTypeElement></SOAP-ENV:Body></SOAP-ENV:Envelope>}
|
||||
, 'SOAP Envelope generation with objects';
|
||||
|
||||
|
||||
401
t/017_generator.t
Normal file
401
t/017_generator.t
Normal file
@@ -0,0 +1,401 @@
|
||||
#!/usr/bin/perl -w
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 18;
|
||||
use lib '../lib';
|
||||
use XML::LibXML;
|
||||
use SOAP::WSDL::SAX::WSDLHandler;
|
||||
use SOAP::WSDL::SAX::MessageHandler;
|
||||
use File::Path;
|
||||
use File::Basename;
|
||||
|
||||
my $path = dirname __FILE__;
|
||||
|
||||
my $filter = SOAP::WSDL::SAX::WSDLHandler->new();
|
||||
my $parser = XML::LibXML->new();
|
||||
$parser->set_handler( $filter );
|
||||
$parser->parse_string( xml() );
|
||||
|
||||
my $wsdl;
|
||||
ok( $wsdl = $filter->get_data() , "get object tree");
|
||||
|
||||
ok $wsdl->create_interface({
|
||||
base_path => "$path/testlib",
|
||||
typemap_prefix => "Test::Typemap::",
|
||||
type_prefix => "Test::Type::",
|
||||
element_prefix => "Test::Element::",
|
||||
interface_prefix => "Test::Interface::",
|
||||
});
|
||||
|
||||
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 $handler = SOAP::WSDL::SAX::MessageHandler->new({
|
||||
class_resolver => 'Test::Typemap::MessageGateway'
|
||||
});
|
||||
$parser->set_handler( $handler );
|
||||
|
||||
TODO: {
|
||||
local $TODO = 'support embedded atomic simpleType/complexType definitions';
|
||||
eval { $parser->parse_string( xml_message() ) };
|
||||
ok ( !$@, 'parse XML message into object tree');
|
||||
};
|
||||
|
||||
|
||||
SKIP: {
|
||||
eval "require Test::Pod";
|
||||
skip 'Cannot test generated POD without Test::POD' , 6 if $@;
|
||||
|
||||
foreach my $module (Test::Pod::all_pod_files( "$path/testlib")) {
|
||||
Test::Pod::pod_file_ok( $module )
|
||||
}
|
||||
}
|
||||
|
||||
# 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 {
|
||||
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>};
|
||||
}
|
||||
@@ -3,7 +3,8 @@ use lib '../lib';
|
||||
eval "require SOAP::WSDL::XSD::Typelib::Builtin";
|
||||
use Storable;
|
||||
|
||||
my $long = SOAP::WSDL::XSD::Typelib::Builtin::long->new( { value => 9 });
|
||||
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';
|
||||
62
t/Expat/01_expat.t
Normal file
62
t/Expat/01_expat.t
Normal file
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/perl -w
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 2;
|
||||
use lib '../lib';
|
||||
use lib 'lib';
|
||||
use lib 't/lib';
|
||||
use XML::LibXML;
|
||||
use SOAP::WSDL::SAX::MessageHandler;
|
||||
|
||||
use_ok(qw/SOAP::WSDL::Expat::MessageParser/);
|
||||
|
||||
use MyComplexType;
|
||||
use MyElement;
|
||||
use MySimpleType;
|
||||
use Benchmark;
|
||||
|
||||
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'
|
||||
});
|
||||
|
||||
my $libxml = XML::LibXML->new();
|
||||
my $handler = SOAP::WSDL::SAX::MessageHandler->new({
|
||||
class_resolver => 'FakeResolver',
|
||||
});
|
||||
$libxml->set_handler( $handler );
|
||||
|
||||
|
||||
$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";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
@@ -1,15 +1,5 @@
|
||||
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/;
|
||||
|
||||
|
||||
@@ -43,8 +43,6 @@ ok $soap = SOAP::WSDL->new(
|
||||
no_dispatch => 1
|
||||
), 'Create SOAP::WSDL object';
|
||||
|
||||
$soap->serializer()->namespace('SOAP-ENV');
|
||||
$soap->serializer()->encodingspace('SOAP-ENC');
|
||||
$soap->proxy('http://helloworld/helloworld.asmx');
|
||||
|
||||
ok $soap->wsdlinit(
|
||||
|
||||
@@ -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 )
|
||||
}
|
||||
@@ -1,16 +1,15 @@
|
||||
use Test::More tests => 4;
|
||||
use Test::More tests => 3;
|
||||
use strict;
|
||||
use warnings;
|
||||
use diagnostics;
|
||||
use lib '../lib';
|
||||
use Benchmark;
|
||||
|
||||
use_ok('SOAP::WSDL::XSD::Typelib::Builtin::string');
|
||||
my $obj;
|
||||
|
||||
ok $obj = SOAP::WSDL::XSD::Typelib::Builtin::string->new(
|
||||
{ value => '& "Aber" <test>'})
|
||||
, "Object creation";
|
||||
$obj = SOAP::WSDL::XSD::Typelib::Builtin::string->new();
|
||||
|
||||
$obj->set_value( '& "Aber" <test>');
|
||||
|
||||
|
||||
is $obj, '& &qout;Aber&qout; <test>'
|
||||
, 'escape text on serialization';
|
||||
|
||||
@@ -6,12 +6,12 @@ use lib '../../lib';
|
||||
use SOAP::WSDL::XSD::Typelib::ComplexType;
|
||||
use base ('SOAP::WSDL::XSD::Typelib::ComplexType');
|
||||
|
||||
my %MyTestName_of; # no :ATTR - _factory takes care of
|
||||
my %MyTestName_of :ATTR(:get<MyTestName>);
|
||||
|
||||
__PACKAGE__->_factory(
|
||||
[ qw(MyTestName) ], # order
|
||||
{ MyTestName => \%MyTestName_of }, # attribute lookup map
|
||||
{ MyTestName => 'MyElement' } # class name lookup map
|
||||
{ MyTestName => 'SOAP::WSDL::XSD::Typelib::Builtin::string' } # class name lookup map
|
||||
);
|
||||
|
||||
sub get_xmlns { 'urn:Test' };
|
||||
|
||||
@@ -9,11 +9,20 @@ use base (
|
||||
'SOAP::WSDL::XSD::Typelib::Builtin::string',
|
||||
);
|
||||
|
||||
sub START {
|
||||
my ($self, $ident, $args_of) =@_;
|
||||
$self->__set_name('MyElementName');
|
||||
}
|
||||
__PACKAGE__->__set_name('MyElementName');
|
||||
sub get_xmlns { 'urn:Test' };
|
||||
|
||||
package MyComplexTypeElement;
|
||||
use strict;
|
||||
use Class::Std::Storable;
|
||||
use SOAP::WSDL::XSD::Typelib::Element;
|
||||
use MyComplexType;
|
||||
use base (
|
||||
'SOAP::WSDL::XSD::Typelib::Element',
|
||||
'MyComplexType',
|
||||
);
|
||||
|
||||
__PACKAGE__->__set_name('MyComplexTypeElement');
|
||||
sub get_xmlns { 'urn:Test' };
|
||||
|
||||
package MyTestElement;
|
||||
@@ -26,10 +35,6 @@ use base (
|
||||
'SOAP::WSDL::XSD::Typelib::Builtin::string',
|
||||
);
|
||||
|
||||
sub START {
|
||||
my ($self, $ident, $args_of) =@_;
|
||||
}
|
||||
|
||||
__PACKAGE__->__set_name('MyTestElement');
|
||||
|
||||
sub get_xmlns { 'urn:Test' };
|
||||
@@ -44,12 +49,9 @@ use base (
|
||||
'SOAP::WSDL::XSD::Typelib::Builtin::string',
|
||||
);
|
||||
|
||||
sub START {
|
||||
my ($self, $ident, $args_of) =@_;
|
||||
$self->__set_name('MyTestElement2');
|
||||
}
|
||||
__PACKAGE__->__set_name('MyTestElement2');
|
||||
|
||||
sub get_xmlns { 'urn:Test' };
|
||||
;
|
||||
|
||||
|
||||
package MyAtomicComplexTypeElement;
|
||||
@@ -63,7 +65,7 @@ use base (
|
||||
'SOAP::WSDL::XSD::Typelib::Element',
|
||||
'SOAP::WSDL::XSD::Typelib::ComplexType',
|
||||
);
|
||||
|
||||
|
||||
my %test_of :ATTR(:get<test>);
|
||||
my %test2_of :ATTR(:get<test2>);
|
||||
|
||||
@@ -76,12 +78,12 @@ __PACKAGE__->_factory(
|
||||
test2 => \%test2_of,
|
||||
},
|
||||
{
|
||||
# this is the <element ref="" variant....
|
||||
test => 'MyTestElement',
|
||||
test2 => 'MyTestElement2',
|
||||
},
|
||||
);
|
||||
|
||||
__PACKAGE__->__set_name('MyAtomicComplexTypeElement');
|
||||
|
||||
|
||||
|
||||
1;
|
||||
|
||||
Reference in New Issue
Block a user