SOAP-Lite-1.09/ 000755 000766 000024 00000000000 12265327263 014250 5 ustar 00fredmoyer staff 000000 000000 SOAP-Lite-1.09/bin/ 000755 000766 000024 00000000000 12265327263 015020 5 ustar 00fredmoyer staff 000000 000000 SOAP-Lite-1.09/Changes 000644 000766 000024 00000116364 12265326274 015557 0 ustar 00fredmoyer staff 000000 000000 #
# Revision history for Perl extension SOAP::Lite.
#
The contents of this file provides a change history for the SOAP::Lite
Perl module. New features are designated with a '+' and bug fixes with
a '!'.
Numbers in square brackets are sourceforge tracker IDs from
https://sourceforge.net/tracker/?group_id=66000&atid=513017
Numbers with # are CPANRT tracker IDs from
http://rt.cpan.org/Public/Dist/Display.html?Name=SOAP-Lite
-----------------------------------------------------------------------
THIS RELEASE
-----------------------------------------------------------------------
1.09 January 14, 2013
! #92025 tighten multipart content-type matching [dmn@debian.org]
1.08 November 8, 2013
! #15703 add no_index for examples to prevent CPAN pollution [githumb.com/sergeyromanov]
1.07 November 7, 2013
! #89948 Remove warning when Content-Id is not present
1.06 August 21, 2013
! #87935 skip all MIME-Parser tests if it is not installed
! #87787 Use of uninitialized value $ns in Lite.pm
1.05 August 18, 2013
! #87848 Fix manifest, fix invalid http version from release blunder
1.04 August 9, 2013
! #87605 Skip XML::Parser::Lite tests if it is missing [github.com/omega]
1.03 August 4, 2013
! #87195 Remove DIME::Tools dep until we can work around its issues
1.02 July 30, 2013
! #87421 1.01 release blew out xml versions. mea culpa.
1.01 July 29, 2013
! #84168 Test t/02-payload.t fails under Perl 5.17.10
! #87127 TEST.pl removed from MANIFEST
! revert #85713 - various reports of environment failures
1.0 July 16, 2013
! #85713 SOAP::Transport::HTTP, 500 error skips parsing of response
! No more Windows 98 client support. Wait, wut?
! Merge SOAP::Transport::TCP back into SOAP::Lite (for now)
! #82416: xop href cid: URI encoded support reported by Michael R. Davis (mrdvt92)
! #85208 bad test plan
! #83750 different headers for mod_perl vs mod_perl2 [Mithun Bhattacharya]
0.716 May 10, 2013
! #17275 Client unable to detect fatal SOAP failure (e.g. unable to connect to host)
! #81471 Force array context for correct Apache header parsing in SOAP::Transport::HTTP
! #45611 deserializing SOAP message with composite attachment raises exception
! #84168 Test t/02-payload.t fails under Perl 5.17.10
! #85098 Monkey patch for LWP::Protocol confuses the toolchain
! #78692 / #84724 / #83715 Sending large object (many levels deep) throws error Incorrect parameter
! #78502 t/08-schema.t noisy under 5.17.2 (unescaped left brace in regex is deprecated)
! #78608 Documentation for "+trace"
! #78639 Spelling error reported by Debian tools
0.715
! #75938 Change to warning / add configuration variable to allow XML tags starting with /xml/i
! #76902 Missing info in "SSL CERTIFICATE AUTHENTICATION" documentation
! #74577 work around/fixes for success with MS WS https/compressed
! #74308 SOAP-Lite fails for operations with period in name
! #73802 client did not set the encoding of the soap-envelope to 'iso-8859-1' in HTTP-request
! #75019 HTTP server doesn't process PIPE signal
! #72836 Processing a SOAP 1.2 request breaks the next SOAP 1.1 response
! #70381 SOAP-Lite performance
! #53375 comments after
! #63693 Uninitalized value (again)
! #37360 Use of uninitialized variables in SOAP tests
! fixed encoding in xmlrpc keys
! #15176 problems with SOAP::Header ->value
0.714
Moved SOAP::Transport::TCP into SOAP-Transport-TPC distribution
! #70329 - not generating attributes properly (deleting id attribute)
0.713
! #52637 error sending a request in perl 5.10.0 containing utf-8 data using the string data type
! #48775 Small bug in SOAP::Packager
! #51178 Emailing: SOAP-Lite-0.710.10.patch
! #55962 Spelling errors
! #52015 defined(%hash) deprecated in Perl 5.11
! #63693 Uninitalized value
! #65655 Assignment of shift to list
! #58538 regression from 0.710.08 soap:Client,Application failed during request deserialization
! #64250 Bleadperl v5.13.7-297-g558b442 breaks SOAP::Lite 0.712
! #68088 XML::Parser::Lite fails tests under perl 5.14 RC1
! #69825 Bug in SOAP/Lite/Deserializer/XMLSchemaSOAP1_2.pm
0.712
! #57409 SOAP::Lite installation problem
! #52015 defined(%hash) deprecated in Perl 5.11
! #39546 use of version.pm
! #52637 error sending a request in perl 5.10.0 containing utf-8 data using the string data type
! #55962 Spelling errors
0.712
SOAP::Transport::JABBER, SOAP::Transport::MQ and SOAP::Tranport::FTP
are now in their own distributions.
! [2790747] Bugtracker specification in META.yml missing
! #45997: Inconsistency in SOAP::Serializer documentation
! #55618: HTTP_TRANSFER_ENCODING can be undefined in SOAP/Transpo
! [2946245] / #54106 Only last Cookie Set
! #50178: Win32 isuue with IO::SessionData and IO::SessionSet
! #41527: SOAP::Lite 0.69 with Apache2 HTTP Server module and mod_perl 2
returns 500 Internal
0.710.10
! #49981: UDDI::Lite version not parsable by cpanplus (again)
0.710.09
! #46444: use SOAP::Lite::Deserializer::XMLSchemaSOAP1_2 missing
! #37151: Strawberry perl 5.10 - Tests fail and then later hang
! #49981: UDDI::Lite version not parsable by cpanplus
! #49011: Fails to install under strawberry perl
! [2825166] In Constant DEFAULT_HTTP_CONTENT_TYPE
! [2832939] chunked client requests are returned 411(Length Required)
! [2860559] serious utf8 bug
! #44568 Tracing unavailable when SOAP::Lite is used as a server
! #44195 submitting patches / mention Nginx transport module in documentation
! [2777361] SOAP 1.2 Content-Type rejected
! #41937 ([patch] enable more tests)
! #39101: Apache2::Const::HTTP_BAD_REQUEST not defined
! #39672: serialization and autotype 'off'
! #41348: t/SOAP/Transport/HTTP/CGI.t failing on 5.6.x
! #20569: XMLRPC::Lite "wrong element 'nil'" exception on ''
+ require Task::Weaken
+ better META.yml generated (Alexandr Ciornii)
0.710.08 - Jul 13 2008
! [ 2015071 ] HTTP header is no more accessible
The HTTP header can be pre-filled again. Now, the HTTP header is cloned
from a (possibly user defined) header for every request
! #37358: Test Failure in Strawberry perl - IO::SessionData
! #37359: Test Failure in Strawberry perl - IO::SessionSet
! [ 2005296 ] CPANTS says META.yml broken
! [ 2005288 ] CPANTS: has_humanreadable_license not ok
! #37040: Memory leak when calling WS using wsdl
SOAP::Transport::HTTP->new() was leaking two scalars per call
0.710.07
! [ 1963995 ] > not deserialized in result
! [ 1833218 ] < and > not deserialized in faultstring/detail
! [ 1959329 ] Incorrect Content-Type while sending requests with no parts
! [ 1945385 ] Incorrect starting part detection for Multipart/Related
0.710.06
! #36477 SOAP::Lite Envelope not stripped down for XMLRPC
! #36455 XMLRPC::Transport::HTTP::CGI generates extra params
0.710.05
! got version number right, finally. Thanks to Graham Barr,
Andreas J. Koenig and Matt S Trout (in alphabetical order) for support
0.071.04
! updated version number and fixed declaring version, so that perl 5.6.2
can parse it, too
! fixed memory leaks with XMLRPC::Lite
v0.71.03
! #35041: SOAP::Lite Passes Decoded Strings to LWP
! #35133: Version Unparsable by ExtUtils::MakeMaker
! #33973: KeepAlive fails to function
! #33773: redefined warnings
! #34514: Subclasses of XMLRPC::Serializer misbehave because of a "ref" call in SOAP::Lite
(actually fixed in 0.71.01, but I forgot to add it to Changes)
0.71.02
! [1942233] Memory leak in 0.69 && 0.71
0.71.01
! #34515: Printing UTF-8 through SOAP::Transport::HTTP throws a warning
! Version numbers updated
! [1904955] Subclassing XMLRPC::Serializer broken
0.71 Feb 2008
- bumped up version. Just curious about commit e-mail.
0.70_08 Feb 25 2008
- bumped up version - accidentally uploaded a ppm to CPAN
0.70_07 Feb 25 2008
+ Added additional callbacks to XML::Parser::Lite and made it work under
(at least) perl5.6.2, 5.8.7, 5.8.8 and 5.10.
Thanks to Adam Leggett.
! Fixes failing test on 5.10. The mechanism for determining whether
a class is loaded in SOAP::Server has been changed to the following:
Assume loaded if
- the class is main
- the class implements the required method
- the corresponding module (file) exists in %INC
This is still error prone - if you know a better algorithm, please help me
out.
0.70_06 Feb 16 2008
! Fixes failing test without FCGI installed
0.70_05 Feb 13 2008
! Fixes #32971 Undefined subroutine &Apache::Constant::BAD_REQUEST called
! Fixes [ 1867264 ] [PATCH] handle empty complexTypes correctly
! Fixes #32810: [PATCH] handle empty complexTypes correctly (duplicate)
! Fixes [ 1864481 ] XML::Parser::Lite documentation is incomplete
+ Fixes [ 747302 ] Make tainting work with XML::Parser::Lite
+ Fixes [ 1864480 ] Make XML::Parser::Lite's private subs private
! Fixes [ uncategorized ] bad XML::Parser::Lite behaviour under perl 5.8
0.70_04 Jan 02 2008
! Fixes #32008: Failed t/03-server.t tests 2-5 under Perl 5.10 on Mac OS X 10.3.9
! Fixes [ 1855575 ] "P" autotyped as xsd:duration
! Fixes [ 1842314 ] Expect: 100-Continue does not work with Apache::SOAP
! Fixes #13140 unable to use local file as WSDL service description file
Acually there is no bug, but just a missing comment in the examples...
0.70_03 Nov 18 2007
! Fixes [ 1816906 ] 7/06_modules.t fails with Apache 1.27
! Fixes [ 1414914 ] longs are serialized into xsd:int by default
- ! Fixes [ 1833803 ] int numbers serialized as long
! Fixes #21113: sending xml files using SOAP::Transport::HTTP::CGI
(actually trapped a documentation error)
! Fixes #3677: Line > 1000 characters breaks perl parser
! Fixes #11797: SOAP::Transport::HTTP::CGI returns HTTP response headers terminated by "\n" instead of "\r\n"
! Fixed #24211: strings with leading zero mistreated as int
! Fixed #25668: cannot build SOAP::Lite with mod_perl 1.29
! Fixed #16897: SOAP::Lite 0.66 fails with UNIVERSAL::use
! Fixed #30741: SOAP::Transport::HTTP::Apache
0.70_02 Nov 08 2007
! Fixed [ 1828412 ] SOAP::Lite serializes faults with wrong element order,
thanks to Tom Fischer.
! Fixed [ 1073360 ] Failure to read() long requests under mod_perl (fixed
for mod_perl before thanks to JT Justman, now fixed for CGI, too).
! Fixed #30339: envelope subroutine() in XMLRPC/Lite.pm incorrectly
requires method parameter for a response envelope
! Fixed #26408: SOAP::Transport::HTTP needs to call extract_cookies when
dealing with a cookie jar
! Fixed #22730 test failure on bleedperl
! Fixed #30271 Don't give strings with utf8 flag set to
MIME::Base64::encode_base64().
! Fixed [ 1816907 ] t/01_core.t fails on 5.6.x
! Fixed #24810 missing prerequisite LWP::UserAgent
0.70_01 Oct 18 2007
+ Added LOOPBACK test transport backend.
+ Added more core tests
! Fixed #14052: 'use base' pragma no longer works for SOAP::Lite
! Fixed #27032: Some debugging-aid patches
! Fixed #22732: Documentation error for use_prefix()
! Fixed [ 1044270 ] Suppress type for array when autotyping off
! Fixed [ 1665916 ] encode_scalar needs "no strict 'refs'"?
! Fixed [ 1481017 ] Typo on CPAN's documentation
! Fixed [ 1750846 ] Error with ENV{EXPECT}
! Fixed [ 887015 ] Memory Leak
! Fixed [ 1700326 ] encode_data called incorrectly in envelope
! Fixed [ 1612405 ] Incorrect deserialization of arrays/vectors
! Fixed [ 1204279 ] Boolean serialization error and added test
! Fixed [ 1569418 ] anyURI Serialization problem
0.68 July 6 2006
! Patched support for mod_perl Apache2 (thanks to JT Justman)
! Fixed bug where SOAP::SOM objects were not properly detected,
serialized and returned (thanks chris at prather dot o r g)
! Fixed bug with default_ns and ns functions so that they
serialized XML properly.
+ Started to add experimental DIME support - possible impacts to MIME
support as well
0.65-beta7 May 12 2005
+ Added default_ns and ns to replace the confusing use of uri() and
use_prefex()
0.65-beta6 June 3 2005
! Fixed bug resulting in XMLRPC requests to be serialized using the
doc/literal serializer if serializing arrays
0.65-beta5 May 6 2005
! Fixed critical bug which prevented all XMLRPC servers from working
0.65-beta4 Apr 3 2005
! Fixed bug 1160881 - HTTP headers are now terminated by \r\n for
compatibility with .NET and compliance with HTTP spec.
! Fixed 1158666 - stubmaker.pl no longer call deprecated subroutine
+ stubmaker.pl got a lot of enhancements - now has help and version
output, run time options, etc. See 'man stubmaker.pl' for more.
+ Classes generated by stub_maker.pl now have a special subroutine
called 'want_som.' When set to 1, the stub class will return a
SOAP::SOM object for every request.
! Fixed bug 1149427 - now capable of returning SOAP::SOM objects
from generated stub classes.
0.65-beta3 Mon Oct 25 2004
+ SOAP::Lite will only warn you once when you call a doc/literal
service
+ Added SOAP::Schema->cache_dir() and SOAP::Schema->cache_ttl(),
which control how code stubs generated from WSDLs are cached to
prevent constant reparsing of WSDL files.
! Tested SOAP::Lite against Google, Salesforce, and FedEx. So far,
clients can successfully call these service providers (at least
some of their operations) - testing does not provide 100% coverage
of their APIs.
0.65-beta2.1 Mon Oct 25 2004
+ Fixed bug in unit tests in which MIME::Tools was not properly detected
resulting in failed unit tests for some users.
+ Fixed some documentation issues (speling, etc).
0.65-beta2 Mon Oct 25 2004
** WARNING ** substantial changes have been made to SOAP::Lite in
this release in regards to how it manages attachments. The changes
may introduce instabilities into your software that relies on this
functionality. Please test your software with 0.65 prior to moving it
to a production environment.
+ Added ReleaseNotes.txt
+ Added section REPORTING BUGS to pod comments
+ Deprecated SOAP::Lite->schema removed
+ Deprecated SOAP::Lite->on_debug removed
+ Deprecated SOAP::Schema->schema in favor of SOAP::Schema->schema_url
+ Added SOAP::Schema->useragent - which returns the LWP::UserAgent instance
that will be used when accessing WSDLs via the SOAP::Lite->service call.
This is helpful when access to a WSDL requires authentication, etc.
+ Made changes that allow messages to be constructed using a NULL body:
+ Added constant OBJS_BY_REF_KEEPALIVE which defaults to 600 - this is
so that services can configure how long to cache objects marked as persistent
using SOAP::Server::Object->objects_by_reference()
+ Added the ability for a user to modify the UserAgent class used
by SOAP::Transport::HTTP::Client, updated Transport.pm's documentation
to reflect this. Added $SOAP::Transport::HTTP::Client::USERAGENT_CLASS
variable as a means of setting this.
+ Added initial DIME support
+ SOAP Packager package/unpackage now take in a context variable as
input because DIME needs to know what version of SOAP you are using.
+ Refactored and rewrote README
+ Renamed SOAP::Schema->stub() to SOAP::Schema->generate_stub. This populates
a private variable called C with the autogenerate Perl code.
+ Added SOAP::Schema->stub() which returns the autogenerated Perl code used
internally by SOAP::Lite. This can be helpful for debugging SOAP::Lite's
utilization of WSDL, as well as helpful to developers working on S::L's
WSDL support.
0.65-beta1 Mon Oct 18 15:55:00 2004
+ Made SOAP::Serializer->readable actually produce readable XML!
! Fixed bug 747312 - Made XML Schema 2001 the default schema
+ Changed typelookup of base64 to base64Binary to conform with 2001
schema
+ Added support for [almost] all XML Schema 2001 built-in datatypes
+ Added register_ns subroutine to SOAP::Serializer
+ Added find_prefix subroutine to SOAP::Serializer
+ Added use_prefix subroutine to SOAP::Serializer
+ Added a necessary set of initial subroutinues to support wsdl2perl
project
+ Added format_datetime to SOAP::Utils
+ Documented SOAP::SOM->parts
+ Added SOAP::SOM->is_multipart
+ Properly escaped characters to facilitate emacs syntax highlighting
+ Ran podchecker to validate all POD comments
! Fixed bug 749636 - changed a croak to a warn to enable socket
timeouts in SOAP::Transport::TCP::Server
+ Added support for UDDI 2/3
+ Majorly revamped product documentation thanks to the kind
contribution made by O'Reilly. Appendix B from "Programming Web
Services with Perl" has been completely integrated.
+ To better segment SOAP::Lite documentation, many modules have been
added that contain documentation only. For those who loved the old
documentation, it can be found in lib/OldDocs/SOAP/*.pm and
lib/OldDocs/SOAP/Transport/*.pm
! Fix a bug in which doclit style arrays were not being deserialized
properly. IOW, Repeated elements were not made into an array, only
the last occurring value was recorded.
+ Added the ability for a SOAP Client to gain direct access to the
HTTP::Request and HTTP::Response objects.
+ Changed default envelope namespace prefix from SOAP-ENV to soap
+ Changed default encoding namespace prefix from SOAP-ENC to soapenc
+ Reachitected MIME support to decouple MIME layer from transport
layer. This only impacts the HTTP layer since that is the only
transport in SOAP::Lite that supports attachments.
+ Creation of SOAP::Packager - decoupled in an extensible way the
packaging of parts (a.k.a. attachments). This is used for encoding
and decoding. This enables a more seemless addition of DIME
support. Changes were made throughout SOAP::Lite to accomodate this
functionality.
- a call "context" was added to SOAP::Server and SOAP::Deserializer
so that those classes could have access to the global
SOAP::Packager instance
- deprecated many function calls and packages having to do with
attachment support
- fixed several of the SOAP::*::new() methods so that they don't
inadvertantly reinitialize themselves and destroy precious context
information in the process
+ Gave developers direct access to MIME::Parser object so that they
can optimize its use. See the following URL to optimize it for
memory consumption, parsing speed, disk utilization, etc:
http://search.cpan.org/dist/MIME-tools/lib/MIME/Parser.pm#OPTIMIZING_YOUR_PARSER
+ Added a context variable to SOAP::Serializer and SOAP::Deserializer
so that they have mechanisms for getting instance data from the
calling context. The value of context is either SOAP::Lite or
SOAP::Server depending upon the role the service is playing in the
transaction. Contexts are initialized when a call is made, and
destroyed when a call is completed.
+ Greater than character '>' has been added to list of characters
that will be automatically escaped. This is not a requirement by
the XML spec, it is a MAY, but I am doing it after seeing a minority
of people report a compatibility problem.
- Removed deprecated methods: SOAP::Serializer::namespace and
encodingspace
+ Added SOAP::Serializer::encodingStyle method which allows users to
set the URI for default encodingStyle.
+ Added initial support for literal encoding style. EXPERIMENTAL
+ Added some true constant values representing various SOAP namespace
URIs
+ Added SOAP::Constants::SUPPORTED_ENCODING_STYLES for better tracking
of the set of encoding styles that the toolkit can [de]serialize
! Fixed bug 840172 - "Makefile.PL --noprompt flag broken," now fixed
+ Updated SOAP 1.2 URIs to the latest (TODO - maintain support for
older ones)
+ Added HTTPS support for HTTP::Server Daemon class - thanks to Nils
Sowen for this contribution
-----------------------------------------------------------------------
PREVIOUS RELEASES
-----------------------------------------------------------------------
0.60 Mon Aug 18 12:10:27 2003
+ Merged SOAP::MIME into SOAP::Lite's core
+ Cleaned up the UI for the Makefile.PL script - it now detects and
indicated whether certain Perl modules have been detected. The
table displaying installation preferences has been substantially
cleaned up, the code is much more modular and relies on a simple
data structure representing potential module dependencies.
+ Made the Makefile.PL script iterative - meaning, the user will be
continually be presented with their preferences until they
explicity choose to accept them and continue (bug 747295)
+ Differentiate between xsd:int and xsd:long to fix interoperability
bug with Java Web services
! Fixed MIME interoperability bug with Apache Axis - Axis' MIME
parser requires that MIME boundaries are terminiated by a CRLF
character where the MIME::Tools package only outputs a CR
character. A patch was integrated into the MIME::Tools module
which allows SOAP::Lite to specify its own MIME Boundary delimiter
! SOAP Faultcodes are now properly typed a xsd:QName, whereas
before they were xsd:string - to be honest, they are left untyped
so that toolkits can serialize them according to the schema
(bug 747283)
! Fixed documentation error around turning on a trace for multiple
"channels" (bug 747310)
! Disabled SOAPStruct (bug 747316)
! Fixed XML::Parser::Expat vulnerability (bug 747265)
! Added item in TROUBLESHOOTING section explaining that there is a
bug in Perl 5.8 that prevents +autodispatch from working properly.
The workaround is to use dispatch_from instead (bug 747290)
! Fixed warning when autodispatched call has no parameters
(bug 747286)
! Fixed warning when empty SOAPAction specified (bug 747278)
! Turned off HTTP keep alive patch by default, however users can now
turn on the patch by setting the constant PATCH_HTTP_KEEPALIVE to
1 (bug 747281)
! Removed dependency on the URI module for non-HTTP transports
(bug 747306)
0.55 Mon Apr 15 22:20:39 2002
! fixed security vulnerability with fully qualified method names
(thanks to Randal Schwartz, Ilya Martynov and many others)
! fixed problem with TCP transport and SSL (thanks to Chris Hurd)
! fixed TCP transport to specify correct length with utf8 strings
(thanks to Robin Fuller)
! fixed incorrect encoding when parameters list includes undefined
values (thanks to Chris Radcliff)
! updated 'xmlsoap' prefix (thanks to Pierre Denis)
! updated MIME parser to accept messages that start with 'From'
(thanks to Chris Davies)
+ added check for TCP transport on Mac (thanks to Robin Fuller)
+ added check for shutdown() method on AIX (thanks to Jos Clijmans)
+ added check for blocking() method in TCP transport
(thanks to Jos Clijmans)
+ optimized parsing strings with entity encoding (thanks to Mathieu
Longtin)
+ added check for entity size for CGI transport
($SOAP::Constant::MAX_CONTENT_SIZE) (thanks to J. Klunder)
+ added example (google.pl)
+ updated tests and examples with new endpoints
0.52 Mon Oct 18 21:20:19 2001
! fixed content_type returned under mod_perl with 500 SERVER ERROR
status (thanks to Geoffrey Young and Scott Hutton)
! fixed problem with multiple bindings in WSDL file generated by
MS SOAP toolkit
! fixed handling of boolean type in 1999 Schema and hexBinary type
in 2001 Schema
! fixed warning and problem with WOULDBLOCK state in IO::SessionData
(thanks to Marty Pauley)
! fixed miscalculation in position within sparse arrays
! fixed problem with URI when methods of SOAP::Data are called in
certain order (thanks to Taras Shkvarchuk)
! fixed CRLF problem in CGI module on Windows platform under IIS
(thanks to Werner Ackerl)
! fixed hex and hexBinary datatypes generation
! fixed content-length calculation when payload has multibyte utf8
characters
! fixed problem with XMLRPC and nested packages with more than two
levels (thanks to Leonid Gernovski)
! fixed (again) memory leak in SOAP::Parser (thanks to Craig
Johnston)
+ updated Jabber interface for new format of 'use Net::Jabber ...'
does not work with Net::Jabber 1.022 and later
+ updated XMLRPC::Lite to not detect value as float for 'NaN' and
'INF' strings
+ updated XMLRPC::Lite to return 200OK on errors
+ updated XMLRPC do not specify charset in content-type
+ updated Makefile.PL to allow configuration from command line
(thanks to Dana Powers)
+ updated publishing API tests for UDDI server to call a new server
(GLUE)
+ changed close() to shutdown() in Daemon transport (thanks to Sean
Meisner)
+ added support for HTTP_proxy and HTTP_proxy_* in WSDL access
(thanks to Stephen Shortland)
+ added XMLRPC support in COM interface. XMLRPC client and server
can be created using COM interface
+ added DO_NOT_PROCESS_XML_IN_MIME option for MIME parts with
text/xml content type
+ modified deserialization algorithm that allows to properly
deserialize SOAP1.2 messages when default is set to SOAP1.1 and
vice versa
+ added fault in XMLRPC::Lite for incorrect datatypes specified by
user (thanks to Paul Prescod)
+ added option to not generate XML declaration
+ added encoding for ']]>' (thanks to Matt Sergeant and James
Amrhein)
+ added '\r' => '
' conversion in strings
+ added complaint on incorrect simple types
+ added byNameOrOrder and byName functions for
SOAP::Server::Parameters (thanks to Matt Stum)
+ added handling relative locations in in WSDL
+ added stringification of SOAP::Fault (thanks to Tim Jenness)
+ added documentation for SSL certificate authentication
+ added more examples (terraserver.pl, joke.pl, weblog.pl)
+ added more tests
0.51 Tue Jul 18 15:15:14 2001
! fixed memory leak in SOAP::Parser (thanks to Ryan Adams and Michael
Brown)
! fixed skipping undef elements in arrays under Perl 5.005 (thanks to
Arne Georg Gleditsch)
! fixed warning from undefined type in out parameters (thanks to
Jrg Ziefle)
! fixed autovivification warnings on 5.7.x (thanks to Igor Pechersky)
! fixed tests on 64bit systems (thanks to Gurusamy Sarathy)
! fixed installation problem with long filenames on MacOS (thanks to
Alex Harper)
! fixed POP3 server (thanks to Kevin Hutchinson)
! number of fixes in XMLRPC::Lite
o fixed requirement (thanks to Matthew Krenzer and Dana
Powers)
o fixed empty slot skipping (thanks to Jon Udell)
o fixed serialization of "0"/""/undef values (thanks to Michael E.
Gage)
o fixed autodispatch (thanks to Craig Kelley)
+ added support for SOAP 1.2 (spec is still in draft, implementation
is subject to change)
+ added extended array support (only in deserializer)
sparse arrays
multidimensional arrays (deserialized as array of arrays)
partially transmitted arrays
+ modified XML::Parser::Lite to work on Perl 5.005 (thanks to John
Gotts)
fixed handling empty attributes as undef
fixed minors (thanks to Duncan Cameron)
+ modified deserializer to work with different schemas (1999/2001)
+ added JABBER transport
+ added MQ transport
+ added mod_xmlrpc transport (Apache::XMLRPC::Lite)
+ added TCP over SSL transport
+ added non-blocking TCP multiserver
+ included FastCGI transport (thanks to Marko Asplund)
+ added support for APOP authentication in POP3 transport
+ added Encoding parameter for MAILTO transport (to choose
base64/binary)
+ added 'autoresult' option (thanks to Mathieu Longtin)
+ added support for import directive in WSDL
+ added support for short (tModel) WSDL service descriptions
+ added support for multiple services/ports and allowed non-SOAP
bindings in WSDL
+ added full search example UDDI->WSDL->SOAP (fullsearch.pl)
+ added charset in response message for HTTP transport
+ modified SOAPsh/XMLRPCsh to return all parameters (thanks to Chris
Davies)
+ modified dispatch for XMLRPC server to work exactly as for SOAP
server examples included in examples/XMLRPC directory
+ added example with Inline::C module (inline.daemon).
Dispatch to C, C++, assembler, Java, Python and Tcl :).
Thanks to Brian Ingerson for his Inline module.
+ all transport are available for both SOAP::Lite and XMLRPC::Lite:
HTTP (daemon, CGI, mod_perl), SMTP/POP3, TCP, IO, JABBER, MQ
+ updated INCOMPATIBILITY section in README file
+ tested on Perl 5.00503, 5.6.0, 5.6.1, 5.7.1 and 5.7.2
+ added SOAP Cookbook (http://cookbook.soaplite.com/)
+ added server scripts for MQ and JABBER transports
+ added roundtrip example for JABBER transport
+ updated documentation and added new examples
+ added more tests (more than 700 for now)
0.50 Wed Apr 18 11:45:14 2001
! fixed tests on Windows platform
! fixed authInfo in UDDI publishing interface
! fixed mod_soap (Apache::SOAP) on Perl 5.005/5.004
! fixed namespace prefix on arrays of arrays
! modified Content-encoding from 'compress' to 'deflate'
+ added XML::Parser::Lite, regexp-based XML parser
used automatically when XML::Parser is not available
+ added examples of custom serialization and deserialization
(XML::DOM)
+ added XMLRPC::Lite (XMLRPC client and server interface)
all transports and features of SOAP::Lite should be available
+ added XMLRPC interactive shell (XMLRPCsh.pl)
+ added dispatching based on URI and SOAPAction (dispatch_with)
+ added dispatching to object (in addition to class/method)
+ added dispatch from specific class(es) (dispatch_from)
+ added limited support for mustUnderstand and actor attributes
+ added SOAP::Fault class for customization of returning Fault
message
+ added charset in HTTP header for requests
+ added check for namespace and types resolving
+ added namespaces declarations from WSDL interface
+ added INCOMPATIBILITY section in README file
+ added live tests/examples for UDDI publishing interface
+ added live tests/examples for basic authentication
+ added XMLRPC server code that validates with Userland's validator
+ added more examples, tests and documentation
0.47 Wed Feb 21 17:11:12 2001
! fixed lack of parameter in MAILTO transport
! fixed minimal version of COM interface to not require absent
modules
+ added compression for HTTP transport
+ added mod_soap interface, add SOAP server functionality
with couple of lines in .htaccess or httpd.conf file
+ added proper serialization of circular multiple references
+ significantly redesigned handling types and URIs
! incompatibilities with ApacheSOAP clients may occur
+ added handling PIPE and INT signals in Daemon server implementation
+ changed return from autodispatched calls:
result() in scalar context and paramsall() in list context
+ redesigned tests and split on core and optional for smooth CPAN
installation
+ added examples for cookie-based authorization
+ added examples in C# and PerlScript for COM interface
+ added more documentation for COM interface
+ updated documentation and added new examples
0.46 Wed Jan 31 16:30:24 2001
! fixed SOAP:: prefix with SOAP::Lite objects
! fixed documentation installation on Unix
! changed interface of schema() method. Use service() instead
+ added COM interface
single dll (standalone or minimal version, downloadable separately)
doesn't require ROPE.dll, MSXML.dll or listener.asp
tested on Windows 98/2K, and should work on Windows 9x/Me/NT/2K
ASP and daemon server implementations
examples in VB/VBS, Excel/VBA, JavaScript, Perl and ASP
+ added parsing multipart/form-data
SOAP server can accept SOAP requests directly from web form
examples are provided (examples/forms/*)
+ added Map type for hash encoding. Tested with ApacheSOAP
+ added function that maps classes to URI (maptype)
+ allowed multiple ports in WSDL
+ tested object interoperability with Apache SOAP
+ optimized internal functions
0.45 Tue Jan 16 00:38:04 2001
! fixed interoperability problem with incorrect Array prefix for
Apache SOAP
+ added interoperability tests for Apache SOAP
+ added interoperability tests with MS SOAP, 4s4c and Lucin
implementations
+ added attachment parsing (singlepart/multipart MIME)
Content-ID and Content-Location are supported
text/xml fragments are supported and parsed
all implementations support MIME encoded messages
+ added IO server implementation (for pipes, mail handlers, FTP and
file processing)
+ added FTP client implementation
+ added global settings, shareable between objects
+ allowed empty URI and non-prefixed method (documentation included)
+ added tests for xml, xml with headers, single and multipart MIME
+ updated documentation and added examples
+ more that 300 tests in test suite
0.44 Tue Dec 12 23:52:12 2000
! fixed mod_perl server to return '500 Server Error' in case of error
! fixed CGI server to work under PerlIS and PerlEx (thanks to Murray
Nesbitt)
+ tested publishing API for UDDI::Lite, examples provided
(thanks to Petr Janata for access to UDDI server and provided help)
+ added bi-directional TCP client/server, examples and tests provided
+ enabled de/serializer overloading on server side (in addition to
client)
+ added optimization for objects-by-reference
+ added ForkingDaemon server implementation (thanks to Peter
Fraenkel)
+ added SOAP::Custom::XML for XML processing, examples and tests
provided
+ added SOAP::Test as simple test framework
+ added documentation for UDDI publishing API
+ redesigned examples and tests (~240 tests for now)
0.43 Tue Nov 28 01:47:02 2000
! fixed bug in UDDI interface that made UDDI client almost useless
! fixed Makefile.PL
! tests confirmed that memory leak is gone
+ changed syntax for UDDI client to more flexible/convenient
+ added limited support for WSDL schemas. Dynamic and stub access
supported
+ added script for stub generation (stubmaker.pl)
+ optimized code on server side
+ object interface for SOAP, UDDI and schemas are supported
consistently
+ allowed manipulation of method's attributes and namespaces
+ added attributes encoding ('&', '<' and '"' are encoded)
+ updated documentation
(thanks to Robert Barta who basically did this work)
+ added more examples and tests (154 for now)
0.42 Tue Nov 14 23:14:18 2000
+ added UDDI client (UDDI::Lite) with documentation
+ added M-POST functionality in HTTP::Client
+ added redirect (3??) functionality in HTTP::Client
+ added session cache for M-POSTs and redirects
+ added conversion of all objects to o-b-r in parameters
+ changed passing envelope into method
+ allowed \x0d and \x0a in strings (will not do base64 encode)
+ added die with object that allows to specify complex Fault detail
+ optimized XML encoding
+ allowed function call with autodispatch
+ improved syntax for 'use SOAP::Lite'
+ added soap.tcp example for TCP server implementation
+ added tests with Microsoft implementation
+ added documentation and tests (145 for now)
0.41 Tue Oct 31 01:24:51 2000
! fixed memory leak on server side
! fixed die on absence of HTTP::* modules on server side
! fixed working with keep-alive connections (added test with
Xmethods)
+ changed autotyping from double to float
+ added support for proxy authorization (thanks to Murray Nesbitt)
+ added TCP client/server implementation
+ added benchmark for all implementations except smtp/pop3
+ added SOAP::Trace for detail logging on client/server side
+ added examples/tests for Apache::Registry implementations
+ added more examples, documentation and tests (127 for now)
0.40 Sun Oct 15 18:20:55 2000
! fixed die in mailto: protocol if you don't have URI::URL installed
! fixed misbehavior on Mac platform (thanks to Carl K. Cunningham)
+ added default namespace processing [xmlns] (thanks to Petr Janata)
+ added objects-by-reference, simple garbage collection and
activation
+ added full access to envelope on server side
+ added versionMismatch reaction
+ added local: protocol for local binding without any transport
+ added examples for objects-by-reference: persistent/session
iterators and chat (40 lines on server and 25 lines on client side)
0.39 Sun Oct 8 22:55:20 2000
! fixed incompatibility with Perl 5.005
+ added interactive Makefile.PL for CPAN installation
0.38 Thu Oct 5 22:06:20 2000
! fixed namespace for base64 encoding
! fixed security problem on server side, upgrade is highly
recommended
+ added HTTPS/SSL support
+ added SMTP client implementation
+ added POP3 server implementation
+ added support for Basic/Digest server authentication
+ added support for header(s) on client/server side with SOAP::Header
+ added Array and SOAPStruct for interoperability with ApacheSOAP
+ added generic class for server support SOAP::Server
+ added Actor attribute
+ added more examples, documentation and tests (88 for now)
0.36 Sun Sep 24 20:12:10 2000
! fixed output parameters autobinding
+ added mod_perl server implementation
+ added recognizing all simple types mentioned in specification
+ added support for 'hex' type
+ added more documentation (twice as much as before)
+ added more tests (74 for now)
0.35 Sun Sep 17 23:57:10 2000
! fixed minors (Response instead of Respond, server will map client's
URI)
+ cleaned HTTP::Server internals (will go to SOAP::Server in the
future)
+ test.pl won't abort on transport errors. Failed test will be
skipped
+ added daemon server implementation
+ added cgi/daemon server implementation examples
+ added deserialization into blessed reference
+ added dynamic/static class/method binding
+ added output parameters matching based on signature (name/type)
+ added real object transferring back and forth (see example of
Chatbot::Eliza, fixed for CODE references)
+ added more interoperability with on_action on client and server
side
+ added new events (on_action, on_fault, on_nonserialized)
+ added global class settings with 'use SOAP::Lite ...'
+ added code for returning application errors on server
+ added autodispatch
+ added SOAP prefix to method calls
+ added more documentation
+ added more tests (54 for now)
+ added more examples (Chatbot::Eliza, My::PingPong)
0.32 Sun Sep 10 23:27:10 2000
! fixed warnings with -w
! fixed blessed reference serialization. Assigned type has top
priority
+ added working with current node in SOAP::SOM
+ SOAP::SOM::valueof returns nodeset
+ SOAP::SOM::match returns boolean in boolean context
+ added raw xml accepting and output
+ added UserAgent parameters to SOAP::Transport (understands timeout)
+ added better diagnostic on transport errors in test.pl
+ added 'method', 'fault', 'freeform' types of Envelope
+ added server implementation
+ added CGI interface to server implementation
+ added My::Examples.pm as example of loaded class for SOAP server
+ added more tests (47 for now)
0.31 Wed Sep 6 00:36:15 2000
+ added expressions to SOAP::SOM->match method
+ added deserialization of circular references
+ added tests for deserialization
+ added documentation
0.3 Mon Sep 4 00:59:04 2000
+ first public beta version
+ added live SOAP calls
+ added test suite (25 tests)
+ added documentation
+ added interactive shell (SOAPsh.pl)
0.2 Mon Aug 24 19:34:24 2000
- next stable version; works with public test servers
0.1 Mon Aug 11 23:12:02 2000
- first version; serialization part only
SOAP-Lite-1.09/examples/ 000755 000766 000024 00000000000 12265327263 016066 5 ustar 00fredmoyer staff 000000 000000 SOAP-Lite-1.09/HACKING 000644 000766 000024 00000011007 12200752752 015230 0 ustar 00fredmoyer staff 000000 000000 HACKING
=======
Development of SOAP::Lite takes place on GitHub.
git@github.com:redhotpenguin/soaplite.git
Come on by and fork it and submit a pull request.
Looking for a few good maintainers! We want you!
SOAP::Lite CODING GUIDELINES
============================
SOAP::Lite's coding style in principle follows Perl Best Practices by
Damian Conway, but allows deviances for speed and backward compatibility
reasons.
The following guidelines apply:
- Symbol table operations
* SOAP::Lite heavily relies on symbol table operations. While this is
nothing bad, you should always try other variants like subclassing before.
Use symbol table operations as a last resort, and preferably consolidate
similar operations into utility functions.
- Autoloading
* SOAP::Lite heavily relies on AUTOLOAD, often together with symbol table
operations. While this is nothing generally bad, it can lead to subtle
errors, for example when switching the underlying protocol handler of
a transport backend. Methods already autoloaded (and cached via symbol
table) remain, even if there's a equally named method in the new protocol
handler.
It's generally best not to rely on AUTOLOAD and symbol table operations -
subclassing is often more appropriate.
- testing
* SOAP::Lite has a test coverage of >60%, but aims at 100%. Please write
a test first.
* Use author tests for testing guidelines. Disable author tests for
users - it's time consuming and of no use to have users run author tests.
Author tests are enabled by setting the "TEST_AUTHOR" environment
variable to a true value.
- Indentation and formatting
* indent with spaces.
* indent 4 characters per level
* use \n (LF) for newlines, not CRLF
* use blank lines to separate paragraphs
* Coding style is similar to K&R (opening brace on last line, closing
brace on new line. No cuddled else)
* No trailing spaces allowed (except to indicate a blank line in a POD
source block)
- Flow control
* postfix if is allowed for single statements only. Preferably for flow
control only like in:
return $self if ref $self;
* postfix for, while, until are not allowed.
* unless is not allowed at all. Use if not.
* goto is only allowed for jumping into subs. Nothing else.
* redo, next, last etc. are preferred over goto.
- Strictness
* always use strict. Switch off for the smallest block
possible, but switch off if there's a reason (don't let tools like
perlcritic fool you: no strict qw(refs); is often required.
- Naming
* variable names are lower case with _ separating words, except when
a XML Schema, SOAP, or WSDL name is name-giving (don't force portType to
become port_type)
* hashes should be named FOO_of, lists FOO_from, references FOO_ref.
* package names are CamelCase, except when a XML, SOAP or WSDL name is
name-giving (don't force 'int' to become 'Int'. However, simpleType
becomes SimpleType).
Protocol names for transport modules are all UPPERCASE, like in
SOAP::Transport::HTTP or in SOAP::Transport::MAILTO.
- Subroutines
* Subroutines shouldn't be more than around 50 lines long
* @_ should be unpacked. Deviances are allowed for speed reasons. If
you're not unpacking @_ in a sub of say, 5 lines or more, please comment
what you're doing.
* The preferred idiom for unpacking @_ is:
my ($self, @arg_from) = @_;
or
my ($self, %arg_of) = @_;
$_[0] is preferred over shift, except where the rest of the parameter
stack is used en block later.
* Always return.
- POD and comments
* Comments denoting some people's copyright on some piece of the code
MUST be kept intact.
* Comment extensively. Comments are the maintainer (and core developer's)
documentation - aid them where possible (your're probably doing yourself
a favor by adding extensive comments).
* Comment either in blocks or as hanging side comments (especially when
commenting @_ access).
Example:
sub baz {
# @_ not unpacked for speed reasons. Read:
# my ($self, $something, %args_of) = @_;
$_[0]->bar($_[1]); # read as $self->bar($something);
$_[0]->foo($_[2..$#]); # read as $self->foo(%args_of);
return;
}
* POD is located at end of file, preferably after __END__
* Complete POD coverage is essential. However, if the package in question
is used internally only, it's better to omit the POD completely - too many
PODs to look at confuse the average CPAN user.
SOAP-Lite-1.09/lib/ 000755 000766 000024 00000000000 12265327263 015016 5 ustar 00fredmoyer staff 000000 000000 SOAP-Lite-1.09/Makefile.PL 000644 000766 000024 00000004301 12237220576 016216 0 ustar 00fredmoyer staff 000000 000000 #!/usr/bin/perl
use strict;
use warnings;
use ExtUtils::MakeMaker;
my %prereqs = (
# Core package
"Test::More" => 0,
"XML::Parser" => "2.23",
"MIME::Base64" => 0,
"URI" => 0,
"Scalar::Util" => 0,
"Task::Weaken" => 0, # to be sure than weaken works
"constant" => 0, # don't force people to upgrade
"Class::Inspector" => 0,
# Client TCP support
"IO::SessionData" => 1.03,
"IO::Socket::SSL" => 0,
# Compression support for HTTP
"Compress::Zlib" => 0,
# Client HTTP support
"LWP::UserAgent" => 0,
# Client HTTPS support
"Crypt::SSLeay" => 0,
# "Standalone HTTP server"
# ,"SOAP::Transport::HTTP::Daemon",{
# "HTTP::Daemon" => 0,
# "Apache/mod_perl server"
# "Apache" => 0,
# "FastCGI server"
# "FCGI" => 0,
# "POP3 server"
# "Net::POP3" => 0,
# "MIME::Parser" => 0,
# "MQ transport support"
# "SOAP::Transport::MQ" => 0.712,
# "JABBER transport support"
# "SOAP::Transport::JABBER" => 0.712,
# MIME messages
# "MIME::Parser" => 0,
# DIME messages
# "IO::Scalar" => "2.105",
# "DIME::Tools" => 0.03,
# "Data::UUID" => "0.11",
#"IO::File" => 0,
# "MIME interoperability w/ Axis"
# "MIME::Parser" => "6.106",
);
ExtUtils::MakeMaker::WriteMakefile(
'NAME' => 'SOAP::Lite',
'AUTHOR' =>
'Pavel Kulchenko, Randy J Ray, Byrne Reese, Martin Kutter (MKUTTER@cpan.org), Fred Moyer',
'LICENSE' => 'perl',
'VERSION_FROM' => 'lib/SOAP/Lite.pm',
'ABSTRACT_FROM' => 'lib/SOAP/Lite.pm',
'PREREQ_PM' => \%prereqs,
'EXE_FILES' => [ 'bin/SOAPsh.pl', 'bin/stubmaker.pl' ],
(
$ExtUtils::MakeMaker::VERSION ge '6.48'
? (
MIN_PERL_VERSION => 5.006,
META_MERGE => {
resources => {
repository => 'https://github.com/redhotpenguin/soaplite',
},
keywords => [ 'SOAP', 'SOAP client', 'SOAP server' ],
no_index => {
directory => [ qw( examples t ) ],
},
},
)
: ()
),
);
1;
SOAP-Lite-1.09/MANIFEST 000644 000766 000024 00000010766 12265327263 015413 0 ustar 00fredmoyer staff 000000 000000 bin/SOAPsh.pl
bin/stubmaker.pl
Changes
examples/allclients.pl
examples/authentication.pl
examples/autoexamples.pl
examples/chat.pl
examples/COM/hash.vbs
examples/COM/hashecho.vbs
examples/COM/local.vbs
examples/COM/make-com-minimal.bat
examples/COM/make-com-standalone.bat
examples/COM/make-com.args
examples/COM/README
examples/COM/remote.cs
examples/COM/remote.vba
examples/COM/remote.vbs
examples/COM/remote.xls
examples/COM/service.vbs
examples/COM/SOAP-Lite-COM-minimal.ctrl
examples/COM/SOAP-Lite-COM-standalone.ctrl
examples/COM/soap.asp
examples/COM/soap.vbs
examples/COM/soap_perl.asp
examples/COM/states.html
examples/COM/states.pl
examples/COM/states.vba
examples/COM/states.vbs
examples/COM/states.xls
examples/COM/temper.vbs
examples/COM/xmlrpc.vbs
examples/compress.pl
examples/cookie.pl
examples/cookieauth.pl
examples/customschema.pl
examples/forms/style.cgi
examples/forms/style.html
examples/fullsearch.pl
examples/getdom.pl
examples/google.pl
examples/inline.daemon
examples/iterator.pl
examples/joke.pl
examples/My/Chat.pm
examples/My/Examples.pm
examples/My/Parameters.pm
examples/My/PersistentIterator.pm
examples/My/PingPong.pm
examples/My/SessionIterator.pm
examples/oneliners
examples/oo-apache.pl
examples/parametersbyname.pl
examples/pingpong.pl
examples/server/Apache.pm
examples/server/mod_soap.htaccess
examples/server/soap.asp
examples/server/soap.cgi
examples/server/soap.daemon
examples/server/soap.daemon.forkafterprocessing
examples/server/soap.daemon.forkonaccept
examples/server/soap.fcgi
examples/server/soap.io
examples/server/soap.jabber
examples/server/soap.mod_cgi
examples/server/soap.mq
examples/server/soap.pop3
examples/server/soap.tcp
examples/server/soap.vbs
examples/server/soap_perl.asp
examples/SOAP/simple1.pl
examples/SOAP/simple2.pl
examples/SOAP/simple3.pl
examples/SOAP/Transport/HTTP/Daemon/ForkAfterProcessing.pm
examples/SOAP/Transport/HTTP/Daemon/ForkOnAccept.pm
examples/soapmark.pl
examples/soapsmtp.pl
examples/tcpclient.pl
examples/terraserver.pl
examples/UDDI/inquire1.pl
examples/UDDI/publish1.pl
examples/UDDI/simple1.pl
examples/UDDI/simple2.pl
examples/UDDI/syntax1.pl
examples/UDDI/syntax2.pl
examples/UDDI/syntax3.pl
examples/weblog.pl
examples/WSDL/dynamic1.pl
examples/WSDL/dynamic2.pl
examples/WSDL/dynamic3.pl
examples/WSDL/dynamic4.pl
examples/WSDL/stub1.pl
examples/WSDL/stub2.pl
examples/WSDL/stub3.pl
examples/XML/customxml.pl
examples/XMLRPC/mod_xmlrpc.htaccess
examples/XMLRPC/simple1.pl
examples/XMLRPC/xmlrpc.cgi
examples/XMLRPC/xmlrpc.daemon
HACKING
Makefile.PL
MANIFEST This list of files
META.yml
README
ReleaseNotes.txt
lib/Apache/SOAP.pm
lib/SOAP/Constants.pm
lib/SOAP/Lite/Deserializer/XMLSchema1999.pm
lib/SOAP/Lite/Deserializer/XMLSchema2001.pm
lib/SOAP/Lite/Deserializer/XMLSchemaSOAP1_1.pm
lib/SOAP/Lite/Deserializer/XMLSchemaSOAP1_2.pm
lib/SOAP/Lite/Packager.pm
lib/SOAP/Lite/Utils.pm
lib/SOAP/Lite.pm
lib/SOAP/Packager.pm
lib/SOAP/Test.pm
lib/SOAP/Transport/HTTP.pm
lib/SOAP/Transport/IO.pm
lib/SOAP/Transport/LOCAL.pm
lib/SOAP/Transport/LOOPBACK.pm
lib/SOAP/Transport/MAILTO.pm
lib/SOAP/Transport/POP3.pm
lib/SOAP/Transport/TCP.pm
lib/SOAP/Client.pod
lib/SOAP/Data.pod
lib/SOAP/Deserializer.pod
lib/SOAP/Fault.pod
lib/SOAP/Header.pod
lib/SOAP/Schema.pod
lib/SOAP/Serializer.pod
lib/SOAP/Server.pod
lib/SOAP/SOM.pod
lib/SOAP/Trace.pod
lib/SOAP/Transport.pod
lib/SOAP/Utils.pod
t/01-core.t
t/010-serializer.t
t/012-cloneable.t
t/013-array-deserialization.t
t/014_UNIVERSAL_use.t
t/015_UNIVERSAL_can.t
t/02-payload.t
t/03-server.t
t/04-attach-cid-encoded.t
t/04-attach.t
t/05-customxml.t
t/06-modules.t
t/08-schema.t
t/096_characters.t
t/097_kwalitee.t
t/098_pod.t
t/099_pod_coverage.t
t/11-cgi.t
t/12-cgi_https.t
t/13-mod_perl.t
t/14-cgi_apache.t
t/15-daemon.t
t/17-mod_soap.t
t/19-apachesoap.t
t/21-public.t
t/22-interop_apache.t
t/23-ppm.t
t/24-wsdl.t
t/36-leaks.t
t/38-packager.t
t/40-loopback.t
t/Issues/rt15176.t
t/Issues/rt53375.t
t/Issues/rt70329.t
t/Issues/rt70381.t
t/Issues/rt72836.t
t/Issues/rt74029.t
t/Issues/rt74308.t
t/Issues/rt75169.t
t/Issues/rt78588.t
t/SOAP/Data.t
t/SOAP/Lite/Deserializer/XMLSchema1999.t
t/SOAP/Lite/Deserializer/XMLSchema2001.t
t/SOAP/Lite/Deserializer/XMLSchemaSOAP1_1.t
t/SOAP/Lite/Deserializer/XMLSchemaSOAP1_2.t
t/SOAP/Lite/Packager.t
t/SOAP/Schema/WSDL.t
t/SOAP/Serializer.t
t/SOAP/Transport/HTTP/CGI.t
t/SOAP/Transport/HTTP.t
t/SOAP/Transport/IO.t
t/SOAP/Transport/LOCAL.t
t/SOAP/Transport/LOOPBACK.t
t/SOAP/Transport/MAILTO.t
t/SOAP/Transport/POP3.t
t/SOAP/Transport/TCP.t
META.json Module JSON meta-data (added by MakeMaker)
SOAP-Lite-1.09/META.json 000644 000766 000024 00000003103 12265327263 015666 0 ustar 00fredmoyer staff 000000 000000 {
"abstract" : "Perl's Web Services Toolkit",
"author" : [
"Pavel Kulchenko, Randy J Ray, Byrne Reese, Martin Kutter (MKUTTER@cpan.org), Fred Moyer"
],
"dynamic_config" : 1,
"generated_by" : "ExtUtils::MakeMaker version 6.78, CPAN::Meta::Converter version 2.132830",
"keywords" : [
"SOAP",
"SOAP client",
"SOAP server"
],
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : "2"
},
"name" : "SOAP-Lite",
"no_index" : {
"directory" : [
"t",
"inc",
"examples",
"t"
]
},
"prereqs" : {
"build" : {
"requires" : {
"ExtUtils::MakeMaker" : "0"
}
},
"configure" : {
"requires" : {
"ExtUtils::MakeMaker" : "0"
}
},
"runtime" : {
"requires" : {
"Class::Inspector" : "0",
"Compress::Zlib" : "0",
"Crypt::SSLeay" : "0",
"IO::SessionData" : "1.03",
"IO::Socket::SSL" : "0",
"LWP::UserAgent" : "0",
"MIME::Base64" : "0",
"Scalar::Util" : "0",
"Task::Weaken" : "0",
"Test::More" : "0",
"URI" : "0",
"XML::Parser" : "2.23",
"constant" : "0",
"perl" : "5.006"
}
}
},
"release_status" : "stable",
"resources" : {
"repository" : {
"url" : "https://github.com/redhotpenguin/soaplite"
}
},
"version" : "1.09"
}
SOAP-Lite-1.09/META.yml 000644 000766 000024 00000001631 12265327263 015522 0 ustar 00fredmoyer staff 000000 000000 ---
abstract: "Perl's Web Services Toolkit"
author:
- 'Pavel Kulchenko, Randy J Ray, Byrne Reese, Martin Kutter (MKUTTER@cpan.org), Fred Moyer'
build_requires:
ExtUtils::MakeMaker: 0
configure_requires:
ExtUtils::MakeMaker: 0
dynamic_config: 1
generated_by: 'ExtUtils::MakeMaker version 6.78, CPAN::Meta::Converter version 2.132830'
keywords:
- SOAP
- 'SOAP client'
- 'SOAP server'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
name: SOAP-Lite
no_index:
directory:
- t
- inc
- examples
- t
requires:
Class::Inspector: 0
Compress::Zlib: 0
Crypt::SSLeay: 0
IO::SessionData: 1.03
IO::Socket::SSL: 0
LWP::UserAgent: 0
MIME::Base64: 0
Scalar::Util: 0
Task::Weaken: 0
Test::More: 0
URI: 0
XML::Parser: 2.23
constant: 0
perl: 5.006
resources:
repository: https://github.com/redhotpenguin/soaplite
version: 1.09
SOAP-Lite-1.09/README 000644 000766 000024 00000172222 12200752752 015130 0 ustar 00fredmoyer staff 000000 000000 NAME
SOAP::Lite - Perl's Web Services Toolkit
DESCRIPTION
SOAP::Lite is a collection of Perl modules which provides a simple and
lightweight interface to the Simple Object Access Protocol (SOAP) both
on client and server side.
PERL VERSION WARNING
As of version SOAP::Lite version 1.0, no perl versions before 5.8 will
be supported.
SOAP::Lite 0.71 will be the last version of SOAP::Lite running on perl
5.005
Future versions of SOAP::Lite will require at least perl 5.6.0
If you have not had the time to upgrade your perl, you should consider
this now.
OVERVIEW OF CLASSES AND PACKAGES
lib/SOAP/Lite.pm
SOAP::Lite - Main class provides all logic
SOAP::Transport - Transport backend
SOAP::Data - Data objects
SOAP::Header - Header Data Objects
SOAP::Serializer - Serializes data structures to SOAP messages
SOAP::Deserializer - Deserializes SOAP messages into SOAP::SOM
objects
SOAP::SOM - SOAP Message objects
SOAP::Constants - Provides access to common constants and defaults
SOAP::Trace - Tracing facilities
SOAP::Schema - Provides access and stub(s) for schema(s)
SOAP::Schema::WSDL - WSDL implementation for SOAP::Schema
SOAP::Server - Handles requests on server side
SOAP::Server::Object - Handles objects-by-reference
SOAP::Fault - Provides support for Faults on server side
SOAP::Utils - A set of private and public utility subroutines
lib/SOAP/Packager.pm
SOAP::Packager - Provides an abstract class for implementing custom
packagers.
SOAP::Packager::MIME - Provides MIME support to SOAP::Lite
SOAP::Packager::DIME - Provides DIME support to SOAP::Lite
lib/SOAP/Transport/HTTP.pm
SOAP::Transport::HTTP::Client - Client interface to HTTP transport
SOAP::Transport::HTTP::Server - Server interface to HTTP transport
SOAP::Transport::HTTP::CGI - CGI implementation of server interface
SOAP::Transport::HTTP::Daemon - Daemon implementation of server
interface
SOAP::Transport::HTTP::Apache - mod_perl implementation of server
interface
lib/SOAP/Transport/POP3.pm
SOAP::Transport::POP3::Server - Server interface to POP3 protocol
lib/SOAP/Transport/MAILTO.pm
SOAP::Transport::MAILTO::Client - Client interface to SMTP/sendmail
lib/SOAP/Transport/LOCAL.pm
SOAP::Transport::LOCAL::Client - Client interface to local transport
lib/SOAP/Transport/TCP.pm
SOAP::Transport::TCP::Server - Server interface to TCP protocol
SOAP::Transport::TCP::Client - Client interface to TCP protocol
lib/SOAP/Transport/IO.pm
SOAP::Transport::IO::Server - Server interface to IO transport
METHODS
All accessor methods return the current value when called with no
arguments, while returning the object reference itself when called with
a new value. This allows the set-attribute calls to be chained together.
new(optional key/value pairs)
$client = SOAP::Lite->new(proxy => $endpoint)
Constructor. Many of the accessor methods defined here may be
initialized at creation by providing their name as a key, followed
by the desired value. The example provides the value for the proxy
element of the client.
transport(optional transport object)
$transp = $client->transport( );
Gets or sets the transport object used for sending/receiving SOAP
messages.
See SOAP::Transport for details.
serializer(optional serializer object)
$serial = $client->serializer( )
Gets or sets the serializer object used for creating XML messages.
See SOAP::Serializer for details.
packager(optional packager object)
$packager = $client->packager( )
Provides access to the "SOAP::Packager" object that the client uses
to manage the use of attachments. The default packager is a MIME
packager, but unless you specify parts to send, no MIME formatting
will be done.
See also: SOAP::Packager.
proxy(endpoint, optional extra arguments)
$client->proxy('http://soap.xml.info/ endPoint');
The proxy is the server or endpoint to which the client is going to
connect. This method allows the setting of the endpoint, along with
any extra information that the transport object may need when
communicating the request.
This method is actually an alias to the proxy method of
SOAP::Transport. It is the same as typing:
$client->transport( )->proxy(...arguments);
Extra parameters can be passed to proxy() - see below.
compress_threshold
See COMPRESSION in HTTP::Transport.
All initialization options from the underlying transport layer
The options for HTTP(S) are the same as for LWP::UserAgent's
new() method.
A common option is to create a instance of HTTP::Cookies and
pass it as cookie_jar option:
my $cookie_jar = HTTP::Cookies->new()
$client->proxy('http://www.example.org/webservice',
cookie_jar => $cookie_jar,
);
For example, if you wish to set the HTTP timeout for a SOAP::Lite
client to 5 seconds, use the following code:
my $soap = SOAP::Lite
->uri($uri)
->proxy($proxyUrl, timeout => 5 );
See LWP::UserAgent.
endpoint(optional new endpoint address)
$client->endpoint('http://soap.xml.info/ newPoint')
It may be preferable to set a new endpoint without the additional
work of examining the new address for protocol information and
checking to ensure the support code is loaded and available. This
method allows the caller to change the endpoint that the client is
currently set to connect to, without reloading the relevant
transport code. Note that the proxy method must have been called
before this method is used.
service(service URL)
$client->service('http://svc.perl.org/Svc.wsdl');
"SOAP::Lite" offers some support for creating method stubs from
service descriptions. At present, only WSDL support is in place.
This method loads the specified WSDL schema and uses it as the basis
for generating stubs.
outputxml(boolean)
$client->outputxml('true');
When set to a true value, the raw XML is returned by the call to a
remote method.
The default is to return the a SOAP::SOM object (false).
autotype(boolean)
$client->autotype(0);
This method is a shortcut for:
$client->serializer->autotype(boolean);
By default, the serializer tries to automatically deduce types for
the data being sent in a message. Setting a false value with this
method disables the behavior.
readable(boolean)
$client->readable(1);
This method is a shortcut for:
$client->serializer->readable(boolean);
When this is used to set a true value for this property, the
generated XML sent to the endpoint has extra characters (spaces and
new lines) added in to make the XML itself more readable to human
eyes (presumably for debugging). The default is to not send any
additional characters.
default_ns($uri)
Sets the default namespace for the request to the specified uri.
This overrides any previous namespace declaration that may have been
set using a previous call to "ns()" or "default_ns()". Setting the
default namespace causes elements to be serialized without a
namespace prefix, like this:
Some .NET web services have been reported to require this XML
namespace idiom.
ns($uri,$prefix=undef)
Sets the namespace uri and optionally the namespace prefix for the
request to the specified values. This overrides any previous
namespace declaration that may have been set using a previous call
to "ns()" or "default_ns()".
If a prefix is not specified, one will be generated for you
automatically. Setting the namespace causes elements to be
serialized with a declared namespace prefix, like this:
use_prefix(boolean)
Deprecated. Use the "ns()" and "default_ns" methods described above.
Shortcut for "serializer->use_prefix()". This lets you turn on/off
the use of a namespace prefix for the children of the /Envelope/Body
element. Default is 'true'.
When use_prefix is set to 'true', serialized XML will look like
this:
When use_prefix is set to 'false', serialized XML will look like
this:
Some .NET web services have been reported to require this XML
namespace idiom.
soapversion(optional value)
$client->soapversion('1.2');
If no parameter is given, returns the current version of SOAP that
is being used by the client object to encode requests. If a
parameter is given, the method attempts to set that as the version
of SOAP being used.
The value should be either 1.1 or 1.2.
envprefix(QName)
$client->envprefix('env');
This method is a shortcut for:
$client->serializer->envprefix(QName);
Gets or sets the namespace prefix for the SOAP namespace. The
default is SOAP.
The prefix itself has no meaning, but applications may wish to chose
one explicitly to denote different versions of SOAP or the like.
encprefix(QName)
$client->encprefix('enc');
This method is a shortcut for:
$client->serializer->encprefix(QName);
Gets or sets the namespace prefix for the encoding rules namespace.
The default value is SOAP-ENC.
While it may seem to be an unnecessary operation to set a value that
isn't relevant to the message, such as the namespace labels for the
envelope and encoding URNs, the ability to set these labels explicitly
can prove to be a great aid in distinguishing and debugging messages on
the server side of operations.
encoding(encoding URN)
$client->encoding($soap_12_encoding_URN);
This method is a shortcut for:
$client->serializer->encoding(args);
Where the earlier method dealt with the label used for the
attributes related to the SOAP encoding scheme, this method actually
sets the URN to be specified as the encoding scheme for the message.
The default is to specify the encoding for SOAP 1.1, so this is
handy for applications that need to encode according to SOAP 1.2
rules.
typelookup
$client->typelookup;
This method is a shortcut for:
$client->serializer->typelookup;
Gives the application access to the type-lookup table from the
serializer object. See the section on SOAP::Serializer.
uri(service specifier)
Deprecated - the "uri" subroutine is deprecated in order to provide
a more intuitive naming scheme for subroutines that set namespaces.
In the future, you will be required to use either the "ns()" or
"default_ns()" subroutines instead of "uri()".
$client->uri($service_uri);
This method is a shortcut for:
$client->serializer->uri(service);
The URI associated with this accessor on a client object is the
service-specifier for the request, often encoded for HTTP-based
requests as the SOAPAction header. While the names may seem
confusing, this method doesn't specify the endpoint itself. In most
circumstances, the "uri" refers to the namespace used for the
request.
Often times, the value may look like a valid URL. Despite this, it
doesn't have to point to an existing resource (and often doesn't).
This method sets and retrieves this value from the object. Note that
no transport code is triggered by this because it has no direct
effect on the transport of the object.
multirefinplace(boolean)
$client->multirefinplace(1);
This method is a shortcut for:
$client->serializer->multirefinplace(boolean);
Controls how the serializer handles values that have multiple
references to them. Recall from previous SOAP chapters that a value
may be tagged with an identifier, then referred to in several
places. When this is the case for a value, the serializer defaults
to putting the data element towards the top of the message, right
after the opening tag of the method-specification. It is serialized
as a standalone entity with an ID that is then referenced at the
relevant places later on. If this method is used to set a true
value, the behavior is different. When the multirefinplace attribute
is true, the data is serialized at the first place that references
it, rather than as a separate element higher up in the body. This is
more compact but may be harder to read or trace in a debugging
environment.
parts( ARRAY )
Used to specify an array of MIME::Entity's to be attached to the
transmitted SOAP message. Attachments that are returned in a
response can be accessed by "SOAP::SOM::parts()".
self
$ref = SOAP::Lite->self;
Returns an object reference to the default global object the
"SOAP::Lite" package maintains. This is the object that processes
many of the arguments when provided on the use line.
The following method isn't an accessor style of method but neither does
it fit with the group that immediately follows it:
call(arguments)
$client->call($method => @arguments);
As has been illustrated in previous chapters, the "SOAP::Lite"
client objects can manage remote calls with auto-dispatching using
some of Perl's more elaborate features. call is used when the
application wants a greater degree of control over the details of
the call itself. The method may be built up from a SOAP::Data
object, so as to allow full control over the namespace associated
with the tag, as well as other attributes like encoding. This is
also important for calling methods that contain characters not
allowable in Perl function names, such as A.B.C.
The next four methods used in the "SOAP::Lite" class are geared towards
handling the types of events than can occur during the message
lifecycle. Each of these sets up a callback for the event in question:
on_action(callback)
$client->on_action(sub { qq("$_[0]") });
Triggered when the transport object sets up the SOAPAction header
for an HTTP-based call. The default is to set the header to the
string, uri#method, in which URI is the value set by the uri method
described earlier, and method is the name of the method being
called. When called, the routine referenced (or the closure, if
specified as in the example) is given two arguments, uri and method,
in that order.
.NET web services usually expect "/" as separator for "uri" and
"method". To change SOAP::Lite's behaviour to use uri/method as
SOAPAction header, use the following code:
$client->on_action( sub { join '/', @_ } );
=item on_fault(callback)
$client->on_fault(sub { popup_dialog($_[1]) });
Triggered when a method call results in a fault response from the
server. When it is called, the argument list is first the client
object itself, followed by the object that encapsulates the fault.
In the example, the fault object is passed (without the client
object) to a hypothetical GUI function that presents an error dialog
with the text of fault extracted from the object (which is covered
shortly under the SOAP::SOM methods).
on_nonserialized(callback)
$client->on_nonserialized(sub { die "$_[0]?!?" });
Occasionally, the serializer may be given data it can't turn into
SOAP-savvy XML; for example, if a program bug results in a code
reference or something similar being passed in as a parameter to
method call. When that happens, this callback is activated, with one
argument. That argument is the data item that could not be
understood. It will be the only argument. If the routine returns,
the return value is pasted into the message as the serialization.
Generally, an error is in order, and this callback allows for
control over signaling that error.
on_debug(callback)
$client->on_debug(sub { print @_ });
Deprecated. Use the global +debug and +trace facilities described in
SOAP::Trace
Note that this method will not work as expected: Instead of
affecting the debugging behaviour of the object called on, it will
globally affect the debugging behaviour for all objects of that
class.
WRITING A SOAP CLIENT
This chapter guides you to writing a SOAP client by example.
The SOAP service to be accessed is a simple variation of the well-known
hello world program. It accepts two parameters, a name and a given name,
and returns "Hello $given_name $name".
We will use "Martin Kutter" as the name for the call, so all variants
will print the following message on success:
Hello Martin Kutter!
SOAP message styles
There are three common (and one less common) variants of SOAP messages.
These address the message style (positional parameters vs. specified
message documents) and encoding (as-is vs. typed).
The different message styles are:
* rpc/encoded
Typed, positional parameters. Widely used in scripting languages.
The type of the arguments is included in the message. Arrays and the
like may be encoded using SOAP encoding rules (or others).
* rpc/literal
As-is, positional parameters. The type of arguments is defined by
some pre-exchanged interface definition.
* document/encoded
Specified message with typed elements. Rarely used.
* document/literal
Specified message with as-is elements. The message specification and
element types are defined by some pre-exchanged interface
definition.
As of 2008, document/literal has become the predominant SOAP message
variant. rpc/literal and rpc/encoded are still in use, mainly with
scripting languages, while document/encoded is hardly used at all.
You will see clients for the rpc/encoded and document/literal SOAP
variants in this section.
Example implementations
RPC/ENCODED
Rpc/encoded is most popular with scripting languages like perl, php and
python without the use of a WSDL. Usual method descriptions look like
this:
Method: sayHello(string, string)
Parameters:
name: string
givenName: string
Such a description usually means that you can call a method named
"sayHello" with two positional parameters, "name" and "givenName", which
both are strings.
The message corresponding to this description looks somewhat like this:
KutterMartin
Any XML tag names may be used instead of the "s-gensym01" stuff -
parameters are positional, the tag names have no meaning.
A client producing such a call is implemented like this:
use SOAP::Lite;
my $soap = SOAP::Lite->new( proxy => 'http://localhost:81/soap-wsdl-test/helloworld.pl');
$soap->default_ns('urn:HelloWorld');
my $som = $soap->call('sayHello', 'Kutter', 'Martin');
die $som->faultstring if ($som->fault);
print $som->result, "\n";
You can of course use a one-liner, too...
Sometimes, rpc/encoded interfaces are described with WSDL definitions. A
WSDL accepting "named" parameters with rpc/encoded looks like this:
The message corresponding to this schema looks like this:
KutterMartin
A web service client using this schema looks like this:
use SOAP::Lite;
my $soap = SOAP::Lite->service("file:say_hello_rpcenc.wsdl");
eval { my $result = $soap->sayHello('Kutter', 'Martin'); };
if ($@) {
die $@;
}
print $som->result();
You may of course also use the following one-liner:
perl -MSOAP::Lite -e 'print SOAP::Lite->service("file:say_hello_rpcenc.wsdl")\
->sayHello('Kutter', 'Martin'), "\n";'
A web service client (without a service description) looks like this.
use SOAP::Lite;
my $soap = SOAP::Lite->new( proxy => 'http://localhost:81/soap-wsdl-test/helloworld.pl');
$soap->default_ns('urn:HelloWorld');
my $som = $soap->call('sayHello',
SOAP::Data->name('name')->value('Kutter'),
SOAP::Data->name('givenName')->value('Martin')
);
die $som->faultstring if ($som->fault);
print $som->result, "\n";
RPC/LITERAL
SOAP web services using the document/literal message encoding are
usually described by some Web Service Definition. Our web service has
the following WSDL description:
The XML message (inside the SOAP Envelope) look like this:
KutterMartinHello Martin Kutter!
This is the SOAP::Lite implementation for the web service client:
use SOAP::Lite +trace;
my $soap = SOAP::Lite->new( proxy => 'http://localhost:80/helloworld.pl');
$soap->on_action( sub { "urn:HelloWorld#sayHello" });
$soap->autotype(0)->readable(1);
$soap->default_ns('urn:HelloWorld');
my $som = $soap->call('sayHello', SOAP::Data->name('parameters')->value(
\SOAP::Data->value([
SOAP::Data->name('name')->value( 'Kutter' ),
SOAP::Data->name('givenName')->value('Martin'),
]))
);
die $som->fault->{ faultstring } if ($som->fault);
print $som->result, "\n";
DOCUMENT/LITERAL
SOAP web services using the document/literal message encoding are
usually described by some Web Service Definition. Our web service has
the following WSDL description:
The XML message (inside the SOAP Envelope) look like this:
KutterMartinHello Martin Kutter!
You can call this web service with the following client code:
use SOAP::Lite;
my $soap = SOAP::Lite->new( proxy => 'http://localhost:80/helloworld.pl');
$soap->on_action( sub { "urn:HelloWorld#sayHello" });
$soap->autotype(0);
$soap->default_ns('urn:HelloWorld');
my $som = $soap->call("sayHello",
SOAP::Data->name('name')->value( 'Kutter' ),
SOAP::Data->name('givenName')->value('Martin'),
);
die $som->fault->{ faultstring } if ($som->fault);
print $som->result, "\n";
Differences between the implementations
You may have noticed that there's little difference between the
rpc/encoded, rpc/literal and the document/literal example's
implementation. In fact, from SOAP::Lite's point of view, the only
differences between rpc/literal and document/literal that parameters are
always named.
In our example, the rpc/encoded variant already used named parameters
(by using two messages), so there's no difference at all.
You may have noticed the somewhat strange idiom for passing a list of
named paraneters in the rpc/literal example:
my $som = $soap->call('sayHello', SOAP::Data->name('parameters')->value(
\SOAP::Data->value([
SOAP::Data->name('name')->value( 'Kutter' ),
SOAP::Data->name('givenName')->value('Martin'),
]))
);
While SOAP::Data provides full control over the XML generated, passing
hash-like structures require additional coding.
WRITING A SOAP SERVER
See SOAP::Server, or SOAP::Transport.
FEATURES
ATTACHMENTS
"SOAP::Lite" features support for the SOAP with Attachments
specification. Currently, SOAP::Lite only supports MIME based
attachments. DIME based attachments are yet to be fully functional.
EXAMPLES
Client sending an attachment
"SOAP::Lite" clients can specify attachments to be sent along with a
request by using the "SOAP::Lite::parts()" method, which takes as an
argument an ARRAY of "MIME::Entity"'s.
use SOAP::Lite;
use MIME::Entity;
my $ent = build MIME::Entity
Type => "image/gif",
Encoding => "base64",
Path => "somefile.gif",
Filename => "saveme.gif",
Disposition => "attachment";
my $som = SOAP::Lite
->uri($SOME_NAMESPACE)
->parts([ $ent ])
->proxy($SOME_HOST)
->some_method(SOAP::Data->name("foo" => "bar"));
Client retrieving an attachment
A client accessing attachments that were returned in a response by using
the "SOAP::SOM::parts()" accessor.
use SOAP::Lite;
use MIME::Entity;
my $soap = SOAP::Lite
->uri($NS)
->proxy($HOST);
my $som = $soap->foo();
foreach my $part (${$som->parts}) {
print $part->stringify;
}
Server receiving an attachment
Servers, like clients, use the SOAP::SOM module to access attachments
transmitted to it.
package Attachment;
use SOAP::Lite;
use MIME::Entity;
use strict;
use vars qw(@ISA);
@ISA = qw(SOAP::Server::Parameters);
sub someMethod {
my $self = shift;
my $envelope = pop;
foreach my $part (@{$envelope->parts}) {
print "AttachmentService: attachment found! (".ref($part).")\n";
}
# do something
}
Server responding with an attachment
Servers wishing to return an attachment to the calling client need only
return "MIME::Entity" objects along with SOAP::Data elements, or any
other data intended for the response.
package Attachment;
use SOAP::Lite;
use MIME::Entity;
use strict;
use vars qw(@ISA);
@ISA = qw(SOAP::Server::Parameters);
sub someMethod {
my $self = shift;
my $envelope = pop;
my $ent = build MIME::Entity
'Id' => "<1234>",
'Type' => "text/xml",
'Path' => "some.xml",
'Filename' => "some.xml",
'Disposition' => "attachment";
return SOAP::Data->name("foo" => "blah blah blah"),$ent;
}
DEFAULT SETTINGS
Though this feature looks similar to autodispatch they have (almost)
nothing in common. This capability allows you specify default settings
so that all objects created after that will be initialized with the
proper default settings.
If you wish to provide common "proxy()" or "uri()" settings for all
"SOAP::Lite" objects in your application you may do:
use SOAP::Lite
proxy => 'http://localhost/cgi-bin/soap.cgi',
uri => 'http://my.own.com/My/Examples';
my $soap1 = new SOAP::Lite; # will get the same proxy()/uri() as above
print $soap1->getStateName(1)->result;
my $soap2 = SOAP::Lite->new; # same thing as above
print $soap2->getStateName(2)->result;
# or you may override any settings you want
my $soap3 = SOAP::Lite->proxy('http://localhost/');
print $soap3->getStateName(1)->result;
Any "SOAP::Lite" properties can be propagated this way. Changes in
object copies will not affect global settings and you may still change
global settings with "SOAP::Lite->self" call which returns reference to
global object. Provided parameter will update this object and you can
even set it to "undef":
SOAP::Lite->self(undef);
The "use SOAP::Lite" syntax also lets you specify default event handlers
for your code. If you have different SOAP objects and want to share the
same "on_action()" (or "on_fault()" for that matter) handler. You can
specify "on_action()" during initialization for every object, but you
may also do:
use SOAP::Lite
on_action => sub {sprintf '%s#%s', @_};
and this handler will be the default handler for all your SOAP objects.
You can override it if you specify a handler for a particular object.
See t/*.t for example of on_fault() handler.
Be warned, that since "use ..." is executed at compile time all "use"
statements will be executed before script execution that can make
unexpected results. Consider code:
use SOAP::Lite proxy => 'http://localhost/';
print SOAP::Lite->getStateName(1)->result;
use SOAP::Lite proxy => 'http://localhost/cgi-bin/soap.cgi';
print SOAP::Lite->getStateName(1)->result;
Both SOAP calls will go to 'http://localhost/cgi-bin/soap.cgi'. If you
want to execute "use" at run-time, put it in "eval":
eval "use SOAP::Lite proxy => 'http://localhost/cgi-bin/soap.cgi'; 1" or die;
Or alternatively,
SOAP::Lite->self->proxy('http://localhost/cgi-bin/soap.cgi');
SETTING MAXIMUM MESSAGE SIZE
One feature of "SOAP::Lite" is the ability to control the maximum size
of a message a SOAP::Lite server will be allowed to process. To control
this feature simply define $SOAP::Constants::MAX_CONTENT_SIZE in your
code like so:
use SOAP::Transport::HTTP;
use MIME::Entity;
$SOAP::Constants::MAX_CONTENT_SIZE = 10000;
SOAP::Transport::HTTP::CGI
->dispatch_to('TemperatureService')
->handle;
IN/OUT, OUT PARAMETERS AND AUTOBINDING
"SOAP::Lite" gives you access to all parameters (both in/out and out)
and also does some additional work for you. Lets consider following
example:
name1name2name3
In that case:
$result = $r->result; # gives you 'name1'
$paramout1 = $r->paramsout; # gives you 'name2', because of scalar context
$paramout1 = ($r->paramsout)[0]; # gives you 'name2' also
$paramout2 = ($r->paramsout)[1]; # gives you 'name3'
or
@paramsout = $r->paramsout; # gives you ARRAY of out parameters
$paramout1 = $paramsout[0]; # gives you 'res2', same as ($r->paramsout)[0]
$paramout2 = $paramsout[1]; # gives you 'res3', same as ($r->paramsout)[1]
Generally, if server returns "return (1,2,3)" you will get 1 as the
result and 2 and 3 as out parameters.
If the server returns "return [1,2,3]" you will get an ARRAY reference
from "result()" and "undef" from "paramsout()".
Results can be arbitrary complex: they can be an array references, they
can be objects, they can be anything and still be returned by "result()"
. If only one parameter is returned, "paramsout()" will return "undef".
Furthermore, if you have in your output parameters a parameter with the
same signature (name+type) as in the input parameters this parameter
will be mapped into your input automatically. For example:
Server Code:
sub mymethod {
shift; # object/class reference
my $param1 = shift;
my $param2 = SOAP::Data->name('myparam' => shift() * 2);
return $param1, $param2;
}
Client Code:
$a = 10;
$b = SOAP::Data->name('myparam' => 12);
$result = $soap->mymethod($a, $b);
After that, "$result == 10 and $b->value == 24"! Magic? Sort of.
Autobinding gives it to you. That will work with objects also with one
difference: you do not need to worry about the name and the type of
object parameter. Consider the "PingPong" example
(examples/My/PingPong.pm and examples/pingpong.pl):
Server Code:
package My::PingPong;
sub new {
my $self = shift;
my $class = ref($self) || $self;
bless {_num=>shift} => $class;
}
sub next {
my $self = shift;
$self->{_num}++;
}
Client Code:
use SOAP::Lite +autodispatch =>
uri => 'urn:',
proxy => 'http://localhost/';
my $p = My::PingPong->new(10); # $p->{_num} is 10 now, real object returned
print $p->next, "\n"; # $p->{_num} is 11 now!, object autobinded
STATIC AND DYNAMIC SERVICE DEPLOYMENT
Let us scrutinize the deployment process. When designing your SOAP
server you can consider two kind of deployment: static and dynamic. For
both, static and dynamic, you should specify "MODULE", "MODULE::method",
"method" or "PATH/" when creating "use"ing the SOAP::Lite module. The
difference between static and dynamic deployment is that in case of
'dynamic', any module which is not present will be loaded on demand. See
the "SECURITY" section for detailed description.
When statically deploying a SOAP Server, you need to know all modules
handling SOAP requests before.
Dynamic deployment allows extending your SOAP Server's interface by just
installing another module into the dispatch_to path (see below).
STATIC DEPLOYMENT EXAMPLE
use SOAP::Transport::HTTP;
use My::Examples; # module is preloaded
SOAP::Transport::HTTP::CGI
# deployed module should be present here or client will get
# 'access denied'
-> dispatch_to('My::Examples')
-> handle;
For static deployment you should specify the MODULE name directly.
You should also use static binding when you have several different
classes in one file and want to make them available for SOAP calls.
DYNAMIC DEPLOYMENT EXAMPLE
use SOAP::Transport::HTTP;
# name is unknown, module will be loaded on demand
SOAP::Transport::HTTP::CGI
# deployed module should be present here or client will get 'access denied'
-> dispatch_to('/Your/Path/To/Deployed/Modules', 'My::Examples')
-> handle;
For dynamic deployment you can specify the name either directly (in that
case it will be "require"d without any restriction) or indirectly, with
a PATH. In that case, the ONLY path that will be available will be the
PATH given to the dispatch_to() method). For information how to handle
this situation see "SECURITY" section.
SUMMARY
dispatch_to(
# dynamic dispatch that allows access to ALL modules in specified directory
PATH/TO/MODULES
# 1. specifies directory
# -- AND --
# 2. gives access to ALL modules in this directory without limits
# static dispatch that allows access to ALL methods in particular MODULE
MODULE
# 1. gives access to particular module (all available methods)
# PREREQUISITES:
# module should be loaded manually (for example with 'use ...')
# -- OR --
# you can still specify it in PATH/TO/MODULES
# static dispatch that allows access to particular method ONLY
MODULE::method
# same as MODULE, but gives access to ONLY particular method,
# so there is not much sense to use both MODULE and MODULE::method
# for the same MODULE
);
In addition to this "SOAP::Lite" also supports an experimental syntax
that allows you to bind a specific URL or SOAPAction to a CLASS/MODULE
or object.
For example:
dispatch_with({
URI => MODULE, # 'http://www.soaplite.com/' => 'My::Class',
SOAPAction => MODULE, # 'http://www.soaplite.com/method' => 'Another::Class',
URI => object, # 'http://www.soaplite.com/obj' => My::Class->new,
})
"URI" is checked before "SOAPAction". You may use both the
"dispatch_to()" and "dispatch_with()" methods in the same server, but
note that "dispatch_with()" has a higher order of precedence.
"dispatch_to()" will be checked only after "URI" and "SOAPAction" has
been checked.
See also: EXAMPLE APACHE::REGISTRY USAGE, "SECURITY"
COMPRESSION
"SOAP::Lite" provides you option to enable transparent compression over
the wire. Compression can be enabled by specifying a threshold value (in
the form of kilobytes) for compression on both the client and server
sides:
*Note: Compression currently only works for HTTP based servers and
clients.*
Client Code
print SOAP::Lite
->uri('http://localhost/My/Parameters')
->proxy('http://localhost/', options => {compress_threshold => 10000})
->echo(1 x 10000)
->result;
Server Code
my $server = SOAP::Transport::HTTP::CGI
->dispatch_to('My::Parameters')
->options({compress_threshold => 10000})
->handle;
For more information see COMPRESSION in HTTP::Transport.
SECURITY
For security reasons, the exisiting path for Perl modules (@INC) will be
disabled once you have chosen dynamic deployment and specified your own
"PATH/". If you wish to access other modules in your included package
you have several options:
1 Switch to static linking:
use MODULE;
$server->dispatch_to('MODULE');
Which can also be useful when you want to import something specific
from the deployed modules:
use MODULE qw(import_list);
2 Change "use" to "require". The path is only unavailable during the
initialization phase. It is available once more during execution.
Therefore, if you utilize "require" somewhere in your package, it
will work.
3 Wrap "use" in an "eval" block:
eval 'use MODULE qw(import_list)'; die if $@;
4 Set your include path in your package and then specify "use". Don't
forget to put @INC in a "BEGIN{}" block or it won't work. For
example,
BEGIN { @INC = qw(my_directory); use MODULE }
INTEROPERABILITY
Microsoft .NET client with SOAP::Lite Server
In order to use a .NET client with a SOAP::Lite server, be sure you use
fully qualified names for your return values. For example:
return SOAP::Data->name('myname')
->type('string')
->uri($MY_NAMESPACE)
->value($output);
In addition see comment about default incoding in .NET Web Services
below.
SOAP::Lite client with a .NET server
If experiencing problems when using a SOAP::Lite client to call a .NET
Web service, it is recommended you check, or adhere to all of the
following recommendations:
Declare a proper soapAction in your call
For example, use "on_action( sub {
'http://www.myuri.com/WebService.aspx#someMethod'; } )".
Disable charset definition in Content-type header
Some users have said that Microsoft .NET prefers the value of the
Content-type header to be a mimetype exclusively, but SOAP::Lite
specifies a character set in addition to the mimetype. This results
in an error similar to:
Server found request content type to be 'text/xml; charset=utf-8',
but expected 'text/xml'
To turn off this behavior specify use the following code:
use SOAP::Lite;
$SOAP::Constants::DO_NOT_USE_CHARSET = 1;
# The rest of your code
Use fully qualified name for method parameters
For example, the following code is preferred:
SOAP::Data->name(Query => 'biztalk')
->uri('http://tempuri.org/')
As opposed to:
SOAP::Data->name('Query' => 'biztalk')
Place method in default namespace
For example, the following code is preferred:
my $method = SOAP::Data->name('add')
->attr({xmlns => 'http://tempuri.org/'});
my @rc = $soap->call($method => @parms)->result;
As opposed to:
my @rc = $soap->call(add => @parms)->result;
# -- OR --
my @rc = $soap->add(@parms)->result;
Disable use of explicit namespace prefixes
Some user's have reported that .NET will simply not parse messages
that use namespace prefixes on anything but SOAP elements
themselves. For example, the following XML would not be parsed:
SOAP::Lite allows users to disable the use of explicit namespaces
through the "use_prefix()" method. For example, the following code:
$som = SOAP::Lite->uri('urn:MyURI')
->proxy($HOST)
->use_prefix(0)
->myMethod();
Will result in the following XML, which is more pallatable by .NET:
Modify your .NET server, if possible
Stefan Pharies :
SOAP::Lite uses the SOAP encoding (section 5 of the soap 1.1 spec),
and the default for .NET Web Services is to use a literal encoding.
So elements in the request are unqualified, but your service expects
them to be qualified. .Net Web Services has a way for you to change
the expected message format, which should allow you to get your
interop working. At the top of your class in the asmx, add this
attribute (for Beta 1):
[SoapService(Style=SoapServiceStyle.RPC)]
Another source said it might be this attribute (for Beta 2):
[SoapRpcService]
Full Web Service text may look like:
<%@ WebService Language="C#" Class="Test" %>
using System;
using System.Web.Services;
using System.Xml.Serialization;
[SoapService(Style=SoapServiceStyle.RPC)]
public class Test : WebService {
[WebMethod]
public int add(int a, int b) {
return a + b;
}
}
Another example from Kirill Gavrylyuk :
"You can insert [SoapRpcService()] attribute either on your class or
on operation level".
<%@ WebService Language=CS class="DataType.StringTest"%>
namespace DataType {
using System;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Services.Description;
[SoapRpcService()]
public class StringTest: WebService {
[WebMethod]
[SoapRpcMethod()]
public string RetString(string x) {
return(x);
}
}
}
Example from Yann Christensen :
using System;
using System.Web.Services;
using System.Web.Services.Protocols;
namespace Currency {
[WebService(Namespace="http://www.yourdomain.com/example")]
[SoapRpcService]
public class Exchange {
[WebMethod]
public double getRate(String country, String country2) {
return 122.69;
}
}
}
Special thanks goes to the following people for providing the above
description and details on .NET interoperability issues:
Petr Janata ,
Stefan Pharies ,
Brian Jepson , and others
TROUBLESHOOTING
SOAP::Lite serializes "18373" as an integer, but I want it to be a
string!
SOAP::Lite guesses datatypes from the content provided, using a set
of common-sense rules. These rules are not 100% reliable, though
they fit for most data.
You may force the type by passing a SOAP::Data object with a type
specified:
my $proxy = SOAP::Lite->proxy('http://www.example.org/soapservice');
my $som = $proxy->myMethod(
SOAP::Data->name('foo')->value(12345)->type('string')
);
You may also change the precedence of the type-guessing rules. Note
that this means fiddling with SOAP::Lite's internals - this may not
work as expected in future versions.
The example above forces everything to be encoded as string (this is
because the string test is normally last and allways returns true):
my @list = qw(-1 45 foo bar 3838);
my $proxy = SOAP::Lite->uri($uri)->proxy($proxyUrl);
my $lookup = $proxy->serializer->typelookup;
$lookup->{string}->[0] = 0;
$proxy->serializer->typelookup($lookup);
$proxy->myMethod(\@list);
See SOAP::Serializer for more details.
"+autodispatch" doesn't work in Perl 5.8
There is a bug in Perl 5.8's "UNIVERSAL::AUTOLOAD" functionality
that prevents the "+autodispatch" functionality from working
properly. The workaround is to use "dispatch_from" instead. Where
you might normally do something like this:
use Some::Module;
use SOAP::Lite +autodispatch =>
uri => 'urn:Foo'
proxy => 'http://...';
You would do something like this:
use SOAP::Lite dispatch_from(Some::Module) =>
uri => 'urn:Foo'
proxy => 'http://...';
Problems using SOAP::Lite's COM Interface
Can't call method "server" on undefined value
You probably did not register Lite.dll using "regsvr32 Lite.dll"
Failed to load PerlCtrl Runtime
It is likely that you have install Perl in two different
locations and the location of ActiveState's Perl is not the
first instance of Perl specified in your PATH. To rectify,
rename the directory in which the non-ActiveState Perl is
installed, or be sure the path to ActiveState's Perl is
specified prior to any other instance of Perl in your PATH.
Dynamic libraries are not found
If you are using the Apache web server, and you are seeing something
like the following in your webserver log file:
Can't load '/usr/local/lib/perl5/site_perl/.../XML/Parser/Expat/Expat.so'
for module XML::Parser::Expat: dynamic linker: /usr/local/bin/perl:
libexpat.so.0 is NEEDED, but object does not exist at
/usr/local/lib/perl5/.../DynaLoader.pm line 200.
Then try placing the following into your httpd.conf file and see if
it fixes your problem.
PassEnv LD_LIBRARY_PATH
SOAP client reports "500 unexpected EOF before status line seen
See "Apache is crashing with segfaults"
Apache is crashing with segfaults
Using "SOAP::Lite" (or XML::Parser::Expat) in combination with
mod_perl causes random segmentation faults in httpd processes. To
fix, try configuring Apache with the following:
RULE_EXPAT=no
If you are using Apache 1.3.20 and later, try configuring Apache
with the following option:
./configure --disable-rule=EXPAT
See http://archive.covalent.net/modperl/2000/04/0185.xml for more
details and lot of thanks to Robert Barta for
explaining this weird behavior.
If this doesn't address the problem, you may wish to try
"-Uusemymalloc", or a similar option in order to instruct Perl to
use the system's own "malloc".
Thanks to Tim Bunce .
CGI scripts do not work under Microsoft Internet Information Server
(IIS)
CGI scripts may not work under IIS unless scripts use the ".pl"
extension, opposed to ".cgi".
Java SAX parser unable to parse message composed by SOAP::Lite
In some cases SOAP messages created by "SOAP::Lite" may not be
parsed properly by a SAX2/Java XML parser. This is due to a known
bug in "org.xml.sax.helpers.ParserAdapter". This bug manifests
itself when an attribute in an XML element occurs prior to the XML
namespace declaration on which it depends. However, according to the
XML specification, the order of these attributes is not significant.
http://www.megginson.com/SAX/index.html
Thanks to Steve Alpert (Steve_Alpert@idx.com) for pointing on it.
PERFORMANCE
Processing of XML encoded fragments
"SOAP::Lite" is based on XML::Parser which is basically wrapper
around James Clark's expat parser. Expat's behavior for parsing XML
encoded string can affect processing messages that have lot of
encoded entities, like XML fragments, encoded as strings. Providing
low-level details, parser will call char() callback for every
portion of processed stream, but individually for every processed
entity or newline. It can lead to lot of calls and additional memory
manager expenses even for small messages. By contrast, XML messages
which are encoded as base64Binary, don't have this problem and
difference in processing time can be significant. For XML encoded
string that has about 20 lines and 30 tags, number of call could be
about 100 instead of one for the same string encoded as
base64Binary.
Since it is parser's feature there is NO fix for this behavior (let
me know if you find one), especially because you need to parse
message you already got (and you cannot control content of this
message), however, if your are in charge for both ends of processing
you can switch encoding to base64 on sender's side. It will
definitely work with SOAP::Lite and it may work with other
toolkits/implementations also, but obviously I cannot guarantee
that.
If you want to encode specific string as base64, just do
"SOAP::Data->type(base64 => $string)" either on client or on server
side. If you want change behavior for specific instance of
SOAP::Lite, you may subclass "SOAP::Serializer", override
"as_string()" method that is responsible for string encoding (take a
look into "as_base64Binary()") and specify new serializer class for
your SOAP::Lite object with:
my $soap = new SOAP::Lite
serializer => My::Serializer->new,
..... other parameters
or on server side:
my $server = new SOAP::Transport::HTTP::Daemon # or any other server
serializer => My::Serializer->new,
..... other parameters
If you want to change this behavior for all instances of SOAP::Lite,
just substitute "as_string()" method with "as_base64Binary()"
somewhere in your code after "use SOAP::Lite" and before actual
processing/sending:
*SOAP::Serializer::as_string = \&SOAP::XMLSchema2001::Serializer::as_base64Binary;
Be warned that last two methods will affect all strings and convert
them into base64 encoded. It doesn't make any difference for
SOAP::Lite, but it may make a difference for other toolkits.
BUGS AND LIMITATIONS
* No support for multidimensional, partially transmitted and sparse
arrays (however arrays of arrays are supported, as well as any other
data structures, and you can add your own implementation with
SOAP::Data).
* Limited support for WSDL schema.
* XML::Parser::Lite relies on Unicode support in Perl and doesn't do
entity decoding.
* Limited support for mustUnderstand and Actor attributes.
PLATFORM SPECIFICS
MacOS
Information about XML::Parser for MacPerl could be found here:
http://bumppo.net/lists/macperl-modules/1999/07/msg00047.html
Compiled XML::Parser for MacOS could be found here:
http://www.perl.com/CPAN-local/authors/id/A/AS/ASANDSTRM/XML-Parser-
2.27-bin-1-MacOS.tgz
RELATED MODULES
Transport Modules
SOAP::Lite allows one to add support for additional transport protocols,
or server handlers, via separate modules implementing the
SOAP::Transport::* interface. The following modules are available from
CPAN:
* SOAP-Transport-HTTP-Nginx
SOAP::Transport::HTTP::Nginx provides a transport module for nginx
()
AVAILABILITY
You can download the latest version SOAP::Lite for Unix or SOAP::Lite
for Win32 from the following sources:
* CPAN: http://search.cpan.org/search?dist=SOAP-Lite
You are welcome to send e-mail to the maintainers of SOAP::Lite with
your comments, suggestions, bug reports and complaints.
ACKNOWLEDGEMENTS
Special thanks to Randy J. Ray, author of *Programming Web Services with
Perl*, who has contributed greatly to the documentation effort of
SOAP::Lite.
Special thanks to O'Reilly publishing which has graciously allowed
SOAP::Lite to republish and redistribute the SOAP::Lite reference manual
found in Appendix B of *Programming Web Services with Perl*.
And special gratitude to all the developers who have contributed
patches, ideas, time, energy, and help in a million different forms to
the development of this software.
HACKING
Latest development takes place on GitHub.com. Come on by and fork it.
git@github.com:redhotpenguin/soaplite.git
Also see the HACKING file.
Actively recruiting maintainers for this module. Come and get it on!
REPORTING BUGS
Please use rt.cpan.org or github to report bugs. Pull requests are
preferred.
COPYRIGHT
Copyright (C) 2000-2007 Paul Kulchenko. All rights reserved.
Copyright (C) 2007-2008 Martin Kutter
Copyright (C) 2013 Fred Moyer
LICENSE
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
This text and all associated documentation for this library is made
available under the Creative Commons Attribution-NoDerivs 2.0 license.
http://creativecommons.org/licenses/by-nd/2.0/
AUTHORS
Paul Kulchenko (paulclinger@yahoo.com)
Randy J. Ray (rjray@blackperl.com)
Byrne Reese (byrne@majordojo.com)
Martin Kutter (martin.kutter@fen-net.de)
Fred Moyer (fred@redhotpenguin.com)
SOAP-Lite-1.09/ReleaseNotes.txt 000644 000766 000024 00000004502 12200752752 017375 0 ustar 00fredmoyer staff 000000 000000 #
# ReleaseNotes.txt
#
The following is a compilation of various issues developers should be aware of
when developing Web services using SOAP::Lite.
LIMITED WSDL SUPPORT - SOAP::Lite is not capable of generating WSDLs
automatically. If you require a WSDL for a service written using SOAP::Lite,
please consider using a tool like XML Spy, or CapeClear's WSDL Editor.
NO ENTITY DECODING
SOAP::Lite uses XML::Parser::Lite which relies on Unicode support in Perl and
doesn't perform XML ENTITY decoding.
LIMITED SUPPORT FOR MUSTUNDERSTAND and ACTOR ATTRIBUTES
SOAP::Lite does not currently heed the soap:mustUnderstand XML attribute, or
SOAP actor attributes.
DOCUMENT-LITERAL SUPPORT
All literal encoding support for SOAP::Lite is marked EXPERIMENTAL, and it is
incomplete. Developers are encouraged to use this capability but should be
fore-warned.
As an alternative, SOAP::WSDL or XML::Compiled::SOAP may be used for
document/literal bindings derived from WSDL definitions.
CLIENT SIDE WSDL SUPPORT
SOAP::Lites ability to consume a WSDL and generate the necessary message based
on that WSDL is improving, but it does not work with complex types.
As an alternative, SOAP::WSDL or XML::Compiled::SOAP may be used for
document/literal bindings derived from WSDL definitions.
SERVICE SIDE WSDL SUPPORT
Perl is a loosely typed language making it extraordinarily difficult to generate
a reliable WSDL based upon reflection of somekind. Therefore, no WSDL can be
generated using SOAP::Lite.
SOAP FAULT NOT GETTING SERIALIZED PROPERLY
A user reported that when a service run under Perl version 5.5003 issues the
die command with a SOAP::Fault as input, that SOAP::Lite does not properly
serialize the Fault object. However, the same code works under 5.6 and above.
NULL BODIES
SOAP::Lite currently allows users to construct an Envelope using a null body,
e.g. . However, SOAP::Lite services have no way
of processing such a message.
XML NAMESPACES ABSENT FROM RESPONSES
A user reported that under mod_perl for a series of requests which were using
SOAP 1.1 and 1.2, that some of the responses to incoming messages lacked the
XSD and XSI namespace declarations causing an error with the receiving .NET
client for those response lacking these attributes.
OBJECTS BY REFERENCE
SOAP::Server->objects_by_reference is marked EXPERIMENTAL
SOAP-Lite-1.09/t/ 000755 000766 000024 00000000000 12265327263 014513 5 ustar 00fredmoyer staff 000000 000000 SOAP-Lite-1.09/t/01-core.t 000644 000766 000024 00000030631 12156373142 016045 0 ustar 00fredmoyer staff 000000 000000 #!/bin/env perl
BEGIN {
unless(grep /blib/, @INC) {
chdir 't' if -d 't';
unshift @INC, '../lib' if -d '../lib';
}
}
use strict;
use Test;
BEGIN { plan tests => 42; }
use SOAP::Lite;
my($a, $s, $r, $serialized, $deserialized);
{ # check 'use ...'
print "'use SOAP::Lite ...' test(s)...\n";
eval 'use SOAP::Lite 99.99'; # hm, definitely should fail
ok(scalar $@ =~ /99.+required/);
}
# These tests are for backwards compatibility
{ # check use of use_prefix and uri together
# test 2 - turn OFF default namespace
$SIG{__WARN__} = sub { ; }; # turn off deprecation warnings
$serialized = SOAP::Serializer->use_prefix(1)->uri("urn:Test")->method(
'testMethod', SOAP::Data->name(test => 123)
);
ok($serialized =~ m!123!);
# test 3 - turn ON default namespace
$serialized = SOAP::Serializer->use_prefix(0)->uri("urn:Test")->method(
'testMethod', SOAP::Data->name(test => 123)
);
ok($serialized =~ m!123!);
}
{ # check use of default_ns, ns, and use_prefix
# test 4
$serialized = SOAP::Serializer->ns("urn:Test")->method(
'testMethod', SOAP::Data->name(test => 123)
);
ok($serialized =~ m!123!);
# test 5
$serialized = SOAP::Serializer->ns("urn:Test","testns")->method(
'testMethod', SOAP::Data->name(test => 123)
);
ok($serialized =~ m!123!);
# test 6
$serialized = SOAP::Serializer->default_ns("urn:Test")->method(
'testMethod', SOAP::Data->name(test => 123)
);
ok($serialized =~ m!123!);
}
{ # check serialization
print "Arrays, structs, refs serialization test(s)...\n";
$serialized = SOAP::Serializer->serialize(
SOAP::Data->name(test => \SOAP::Data->value(1, [1,2], {a=>3}, \4))
);
ok($serialized =~ m!11234!);
}
{ # check simple circular references
print "Simple circular references (\$a=\\\$a) serialization test(s)...\n";
$a = \$a;
$serialized = SOAP::Serializer->namespaces({})->serialize($a);
ok($serialized =~ m!!);
$a = SOAP::Deserializer->deserialize($serialized)->root;
ok(0+$a == 0+(values%$a)[0]);
}
{ # check complex circular references
print "Complex circlular references serialization test(s)...\n";
$a = SOAP::Deserializer->deserialize(<<'EOX')->root;
178
EOX
ok($a->{a}->{next}->{next}->{next}->{next}->{x} ==
$a->{a}->{next}->{x});
$a = { a => 1 }; my $b = { b => $a }; $a->{a} = $b;
$serialized = SOAP::Serializer->autotype(0)->namespaces({})->serialize($a);
ok($serialized =~ m!!);
}
{ # check multirefs
print "Multireferences serialization test(s)...\n";
$a = 1; my $b = \$a;
$serialized = SOAP::Serializer->new(multirefinplace=>1)->serialize(
SOAP::Data->name(test => \SOAP::Data->value($b, $b))
);
ok($serialized =~ m!1!);
$serialized = SOAP::Serializer->namespaces({})->serialize(
SOAP::Data->name(test => \SOAP::Data->value($b, $b))
);
print $serialized, "\n";
ok($serialized =~ m!1!);
}
{ # check base64, XML encoding of elements and attributes
print "base64, XML encoding of elements and attributes test(s)...\n";
$serialized = SOAP::Serializer->serialize(
SOAP::Data->name(test => \SOAP::Data->value("\0\1\2\3 \4\5\6", "<123>&\015123>"))
);
ok($serialized =~ m!AAECAyAgIAQFBg==<123>&
</123>!);
$serialized = SOAP::Serializer->namespaces({})->serialize(
SOAP::Data->name(name=>'value')->attr({attr => '<123>"&"123>'})
);
ok($serialized =~ m!^<\?xml version="1.0" encoding="UTF-8"\?>value$!);
}
{ # check objects and SOAP::Data
print "Blessed references and SOAP::Data encoding test(s)...\n";
$serialized = SOAP::Serializer->serialize(SOAP::Data->uri('some_urn' => bless {a => 1} => 'ObjectType'));
ok($serialized =~ m!1!);
}
{ # check serialization/deserialization of simple types
print "Serialization/deserialization of simple types test(s)...\n";
$a = 'abc234xyz';
$serialized = SOAP::Serializer->serialize(SOAP::Data->type(hex => $a));
ok($serialized =~ m!61626332333478797A!);
ok(SOAP::Deserializer->deserialize($serialized)->root eq $a);
$a = <<"EOBASE64";
qwertyuiop[]asdfghjkl;'zxcvbnm,./QWERTYUIOP{}ASDFGHJKL:"ZXCVBNM<>?`1234567890-=\~!@#$%^&*()_+|
EOBASE64
$serialized = SOAP::Serializer->serialize($a);
ok(index($serialized, quotemeta(q!qwertyuiop[]asdfghjkl;'zxcvbnm,./QWERTYUIOP{}ASDFGHJKL:"ZXCVBNM<>?`1234567890-=~\!@#0^&*()_+|!)));
if (UNIVERSAL::isa(SOAP::Deserializer->parser->parser => 'XML::Parser::Lite')) {
skip(q!Entity decoding is not supported in XML::Parser::Lite! => undef);
} else {
ok(SOAP::Deserializer->deserialize($serialized)->root eq $a);
}
$a = <<"EOBASE64";
qwertyuiop[]asdfghjkl;'zxcvbnm,./
QWERTYUIOP{}ASDFGHJKL:"ZXCVBNM<>?
\x00
EOBASE64
$serialized = SOAP::Serializer->serialize($a);
ok($serialized =~ /base64/);
}
{ # check serialization/deserialization of blessed reference
print "Serialization/deserialization of blessed reference test(s)...\n";
$serialized = SOAP::Serializer->serialize(bless {a => 1} => 'SOAP::Lite');
$a = SOAP::Deserializer->deserialize($serialized)->root;
ok(ref $a eq 'SOAP::Lite' && UNIVERSAL::isa($a => 'HASH'));
$a = SOAP::Deserializer->deserialize(
SOAP::Serializer->serialize(bless [a => 1] => 'SOAP::Lite')
)->root;
ok(ref $a eq 'SOAP::Lite' && UNIVERSAL::isa($a => 'ARRAY'));
}
{ # check serialization/deserialization of undef/empty elements
print "Serialization/deserialization of undef/empty elements test(s)...\n";
{ local $^W; # suppress warnings
$a = undef;
$serialized = SOAP::Serializer->serialize(
SOAP::Data->type(negativeInteger => $a)
);
ok(! defined SOAP::Deserializer->deserialize($serialized)->root);
my $type = 'nonstandardtype';
eval {
$serialized = SOAP::Serializer->serialize(
SOAP::Data->type($type => $a)
);
};
ok($@ =~ /for type '$type' is not specified/);
$serialized = SOAP::Serializer->serialize(
SOAP::Data->type($type => {})
);
ok(ref SOAP::Deserializer->deserialize($serialized)->root eq $type);
}
}
{
print "Check for unspecified Transport module test(s)...\n";
eval { SOAP::Lite->new->abc() };
ok($@ =~ /A service address has not been specified/);
}
{
print "Deserialization of CDATA test(s)...\n";
UNIVERSAL::isa(SOAP::Deserializer->parser->parser => 'XML::Parser::Lite') ?
skip(q!CDATA decoding is not supported in XML::Parser::Lite! => undef) :
ok(SOAP::Deserializer->deserialize(']]>')->root eq '<123>');
}
{
print "Test of XML::Parser External Entity vulnerability...\n";
UNIVERSAL::isa(SOAP::Deserializer->parser->parser => 'XML::Parser::Lite') ?
skip(q!External entity references are not supported in XML::Parser::Lite! => undef) :
ok(!eval { SOAP::Deserializer->deserialize(' ]>≪')->root } and $@ =~ /^External entity/);
}
{
print "Test SOAP:: prefix with no +autodispatch option...\n";
eval { A->SOAP::b };
ok($@ =~ /^SOAP:: prefix/);
}
{
# check deserialization of an array of multiple elements
# nested within a complex type
print "Deserialization of document/literal arrays nested in complex types...\n";
my $input = '100onetwo';
my $deserializer = SOAP::Deserializer->new;
my $ret = $deserializer->deserialize($input);
my @arr = @{$ret->result->{'complexFoo'}{'arrayFoo'}};
ok($#arr == 1);
ok("one" eq $arr[0]);
ok("two" eq $arr[1]);
ok(100 == $ret->result->{"id"});
# If only one araryFoo tag is found, it's deserialized as a scalar.
$input = '100one';
$ret = $deserializer->deserialize($input);
ok("one" eq $ret->result->{'complexFoo'}{'arrayFoo'});
}
{
print "Serialization of document/literal arrays\n";
# check array serialization with autotyping disabled
my $serializer = SOAP::Serializer->new;
$serializer->autotype(0);
my $hash = {
"scalar" => 1,
"array" => [ 2, 3],
"hash" => {
"scalar" => 4,
"array" => [ 5, 6],
}
};
my $xml = $serializer->serialize($hash);
ok($xml =~ m{
]*>
(:?
(:?
56
|4
){2}
| 23
| 1
){3}
}xms
);
# deserialize it and check that a similar object is created
my $deserializer = SOAP::Deserializer->new;
my $obj = $deserializer->deserialize($xml)->root;
ok(1, $obj->{"scalar"});
my @arr= @{$obj->{"array"}};
ok(2, $arr[0]);
ok(3, $arr[1]);
ok(4, $obj->{"hash"}{"scalar"});
@arr = @{$obj->{"hash"}{"array"}};
ok(5, $arr[0]);
ok(6, $arr[1]);
}
SOAP-Lite-1.09/t/010-serializer.t 000644 000766 000024 00000010271 12156373142 017344 0 ustar 00fredmoyer staff 000000 000000 use strict;
use warnings;
use Test;
use SOAP::Lite;
my @types1999 = qw(
anyURI
string float double decimal timeDuration recurringDuration uriReference
integer nonPositiveInteger negativeInteger long int short byte
nonNegativeInteger unsignedLong unsignedInt unsignedShort unsignedByte
positiveInteger timeInstant time timePeriod date month year century
recurringDate recurringDay language
);
my @types2001 = qw(
anyType anyURI
string float double decimal dateTime timePeriod gMonth gYearMonth gYear
century gMonthDay gDay duration recurringDuration anyURI
language integer nonPositiveInteger negativeInteger long int short byte
nonNegativeInteger unsignedLong unsignedInt unsignedShort unsignedByte
positiveInteger date time dateTime
);
# types * 3 + extra tests + autotype tests
plan tests => 225;
test_serializer('SOAP::XMLSchema1999::Serializer', @types1999);
test_serializer('SOAP::XMLSchema2001::Serializer', @types2001);
sub test_serializer {
my $package = shift;
my @types = @_;
print "# $package\n";
for my $type (@types) {
my $method = "as_$type";
print "# $method\n";
use Data::Dumper;
my $result = $package->$method('', 'test', $type , {});
ok $result->[0] eq 'test';
ok $result->[1]->{ 'xsi:type' };
ok $result->[2] eq '';
}
}
# additional tests
ok (SOAP::XMLSchema1999::Serializer->anyTypeValue eq 'ur-type');
my $enc = SOAP::XMLSchema1999::Serializer->as_hex('AA', 'test', 'hex', {});
ok $enc->[2] eq '4141';
$enc = SOAP::XMLSchema1999::Serializer->as_dateTime('AA', 'test', 'FOO', {});
ok $enc->[1]->{'xsi:type'} eq 'xsd:dateTime';
ok $enc->[2] eq 'AA';
$enc = SOAP::XMLSchema1999::Serializer->as_boolean(1, 'test', 'boolean', {});
ok $enc->[2] eq 'true';
$enc = SOAP::XMLSchema1999::Serializer->as_boolean(0, 'test', 'boolean', {});
ok $enc->[2] eq 'false';
$enc = SOAP::XMLSchema1999::Serializer->as_undef(1, 'test', 'boolean', {});
ok $enc eq '1';
$enc = SOAP::XMLSchema1999::Serializer->as_undef(0, 'test', 'boolean', {});
ok $enc eq '0';
$enc = SOAP::XMLSchema1999::Serializer->as_base64(0, 'test', 'string', {});
ok ($enc->[2] eq 'MA==');
print "# encoding/decoding Euro symbol in base64\n";
if ($] < 5.008) {
print "# Skippng unicode test on perl <5.8 ($])\n";
ok(1);
ok(1);
}
else {
eval {
# may fail on old perls
my $str = chr(8364);
utf8::encode($str);
my $enc = SOAP::XMLSchema1999::Serializer->as_base64($str, 'test', 'string', {});
my $enc2001 = SOAP::XMLSchema2001::Serializer->as_base64Binary($str, 'test', 'string', {});
use MIME::Base64;
for ($enc, $enc2001) {
if ( decode_base64($_->[2]) eq $str ) {
ok(1);
}
else {
print "$str, ", decode_base64($enc->[2]), "\n";
ok(0);
}
}
}
}
eval { SOAP::XMLSchema1999::Serializer->as_string([], 'test', 'string', {}) };
ok $@ =~m{ \A String \s value \s expected }xms;
eval { SOAP::XMLSchema1999::Serializer->as_anyURI([], 'test', 'string', {}) };
ok $@ =~m{ \A String \s value \s expected }xms;
ok ! SOAP::XMLSchema1999::Serializer->DESTROY();
my $serializer = SOAP::Serializer->new();
my $fault_envelope = $serializer->envelope(
fault => 'Code', 'string', 'Detail', 'Actor'
);
# Test fault serialization order
ok $fault_envelope =~m{ .+(faultcode).+(faultstring).+(faultactor).+(detail)}x;
$serializer = SOAP::Serializer->new();
print "# autotype tests\n";
$serializer->autotype(1);
my %type_of = (
'true' => 'xsd:boolean',
'false' => 'xsd:boolean',
'rtue' => 'xsd:string',
'aflse' => 'xsd:string',
'012345' => 'xsd:string',
'Hello World' => 'xsd:string',
'http://example.org' => 'xsd:anyURI',
'12345' => 'xsd:int',
'-2147483648' => 'xsd:int',
'2147483647' => 'xsd:int',
'2147483648' => 'xsd:long',
'5999927619709920' => 'xsd:long',
'P' => 'xsd:string',
'PT' => 'xsd:string',
'PT01S' => 'xsd:duration',
);
while (my ($value, $type) = each %type_of) {
my $result = $serializer->encode_scalar($value, 'test', undef, {});
print "# $value => $type (result: $result->[1]->{'xsi:type'})\n";
ok ( $result->[1]->{'xsi:type'} eq $type );
} SOAP-Lite-1.09/t/012-cloneable.t 000644 000766 000024 00000000351 12156373142 017117 0 ustar 00fredmoyer staff 000000 000000 use strict;
use warnings;
use Test;
use SOAP::Lite;
plan tests => 2;
my $soap = SOAP::Lite->new(
readable => 1,
outputxml => 1,
);
my $clone = $soap->clone();
ok ($clone->readable() == 1);
ok ($clone->outputxml() == 1);
SOAP-Lite-1.09/t/013-array-deserialization.t 000644 000766 000024 00000004116 12156373142 021501 0 ustar 00fredmoyer staff 000000 000000 #!/usr/bin/perl
use strict;
use Test;
plan tests => 5;
local $/ = undef;
my $xml = ;
use SOAP::Lite;
my $som = SOAP::Deserializer->new->deserialize($xml);
my $result = $som->result();
ok (@$result == 2);
ok $result->[0]->isa('outer');
ok $result->[1]->isa('outer');
ok $result->[1]->{ kids }->[0]->isa('inner');
ok $result->[1]->{ kids }->[1]->isa('inner');
__DATA__
aaaabbbabb
SOAP-Lite-1.09/t/014_UNIVERSAL_use.t 000644 000766 000024 00000000403 12156373142 017501 0 ustar 00fredmoyer staff 000000 000000 use Test;
use SOAP::Lite;
plan tests => 1;
eval "use UNIVERSAL::require"
or do {
print "# Test should always without UNIVERSAL::use installed\n";
};
my $obj = SOAP::Custom::XML::Data->new();
eval { $obj->use('SOAP-encoded') };
ok !$@; SOAP-Lite-1.09/t/015_UNIVERSAL_can.t 000644 000766 000024 00000001422 12156373142 017451 0 ustar 00fredmoyer staff 000000 000000 #!/usr/bin/perl -w
use Test;
BEGIN {
if ($] < 5.008001) {
print "# +autodispatch broken in 5.8.0\n";
plan tests => 0;
exit 0;
}
}
package foo;
sub new {
my $class = shift;
my $self = {count => 0,};
bless $self, $class;
}
sub bar {
my $self = shift;
++$self->{count};
}
sub proxy {
my $self = shift;
my $meth = shift;
if ($self->can($meth)) {
return $self->$meth;
} else {
return;
}
}
# This code works if it's a regular class
package main;
use Test;
plan tests => 3;
my $f = new foo();
use SOAP::Lite +autodispatch =>
uri => 'http://example.org/foo',
proxy => 'http://example.org.cgi';
ok $f->bar() == 1;
if ($f->can("bar")) {
ok $f->bar == 2;
}
if ($f->can("proxy")) {
ok $f->proxy("bar") == 3;
} SOAP-Lite-1.09/t/02-payload.t 000644 000766 000024 00000100400 12200752752 016535 0 ustar 00fredmoyer staff 000000 000000 #!/bin/env perl
BEGIN {
unless(grep /blib/, @INC) {
chdir 't' if -d 't';
unshift @INC, '../lib' if -d '../lib';
}
}
use strict;
use Test;
BEGIN {
plan tests => 133;
}
use SOAP::Lite;
$SIG{__WARN__} = sub { ; }; # turn off deprecation warnings
my($a, $s, $r, $serialized, $deserialized);
{ # check root, mustUnderstand
print "root and mustUnderstand attributes with SOAP::Data test(s)...\n";
$serialized = SOAP::Serializer->serialize(SOAP::Data->root(1 => 1)->name('rootandunderstand')->mustUnderstand(1));
ok($serialized =~ m!1!);
}
{ # check deserialization of envelope with result
print "Deserialization of envelope with result test(s)...\n";
$deserialized = SOAP::Deserializer->deserialize('
204060100200
');
ok($deserialized->result->[2] == 60);
ok((my @array = $deserialized->paramsall) == 1);
ok(ref $deserialized->body eq 'HASH'); # not blessed anymore since 0.51
}
{ # check deserialization of envelope with fault
print "Deserialization of envelope with fault test(s)...\n";
$deserialized = SOAP::Deserializer->deserialize('
soap:ClientApplication ErrorInvalid Password
');
ok($deserialized->faultcode eq 'soap:Client');
ok($deserialized->faultstring eq 'Application Error');
ok($deserialized->faultdetail eq 'Invalid Password');
}
{ # check deserialization of circular references
print "Deserialization of circular references test(s)...\n";
$deserialized = SOAP::Deserializer->deserialize('
');
ok(ref $deserialized->valueof('/Struct') eq ref $deserialized->valueof('//b'));
ok($deserialized->dataof('/Struct')->attr->{'{aaa}id'} == 123);
ok(exists $deserialized->dataof('/Struct')->attr->{'id'});
}
{ # check SOAP::SOM
print "SOM test(s)...\n";
$deserialized = SOAP::Deserializer->deserialize('
204060100200200200200400450600
');
# should return STRING '/Envelope/Body/[1]/[1]'
my $result = SOAP::SOM::result;
ok($deserialized->valueof("$result/[1]") == 20);
ok($deserialized->valueof("$result/[3]") == 60);
ok($deserialized->valueof("$result/[5]") == 200);
ok($deserialized->valueof("$result/[9]") == 400);
# Test more than 9 items to check depth is okay - RT78692
ok($deserialized->valueof("$result/[11]") == 600);
# match should return true/false in boolean context (and object ref otherwise)
ok($deserialized->match('aaa') ? 0 : 1);
# should return same string as above
ok($deserialized->match(SOAP::SOM->result));
ok($deserialized->valueof('[1]') == 20);
ok($deserialized->valueof('[3]') == 60);
ok($deserialized->valueof('[5]') == 200);
$deserialized->match('//Body/[1]/[1]'); # match path and change current node on success
ok($deserialized->valueof('[1]') == 20);
ok($deserialized->valueof('[3]') == 60);
ok($deserialized->valueof('[5]') == 200);
}
{ # check output parameters
print "Output parameters test(s)...\n";
$deserialized = SOAP::Deserializer->deserialize('
name1name2name3
');
my @paramsout = $deserialized->paramsout;
ok($paramsout[0] eq 'name2' && $paramsout[1] eq 'name3');
}
{ # check nonqualified namespace
print "Nonqualified namespace test(s)...\n";
$deserialized = SOAP::Deserializer->deserialize('
204060100200
');
ok($deserialized->namespaceuriof(SOAP::SOM::method) eq 'http://simon.fell.com/calc');
ok($deserialized->namespaceuriof('//doublerResponse') eq 'http://simon.fell.com/calc');
}
{ # check for Array of Array serialization
print "Array of Array serialization test(s)...\n";
$serialized = SOAP::Serializer
->readable(1)
->method('mymethod' => [[1, 2], [3, 4]]);
ok($serialized =~ m!soapenc:arrayType="soapenc:Array\[2\]"!);
}
{ # check for serialization with SOAPStruct
print "Serialization w/out SOAPStruct test(s)...\n";
$a = { a => 1 };
$serialized = SOAP::Serializer->namespaces({})->serialize($a);
ok($serialized =~ m!1!);
}
{ # check header/envelope serialization/deserialization
print "Header/Envelope serialization/deserialization test(s)...\n";
$serialized = SOAP::Serializer->method( # same as ->envelope(method =>
'mymethod', 1, 2, 3,
SOAP::Header->name(t1 => 5)->mustUnderstand(1)->uri('http://namespaces.soaplite.com/headers'),
SOAP::Header->name(t2 => 7)->mustUnderstand(2),
);
$deserialized = SOAP::Deserializer->deserialize($serialized);
my $t1 = $deserialized->match(SOAP::SOM::header)->headerof('t1');
my $t2 = $deserialized->dataof('t2');
my $t3 = eval { $deserialized->headerof(SOAP::SOM::header . '/{http://namespaces.soaplite.com/headers}t3'); };
ok(!$@ && !defined $t3);
my @paramsin = $deserialized->paramsin;
my @paramsall = $deserialized->paramsall;
ok($t2->type =~ /^int$/);
ok($t2->mustUnderstand == 1);
ok(@paramsin == 3);
ok(@paramsall == 3);
eval { $deserialized->result(1) };
ok($@ =~ /Method 'result' is readonly/);
$serialized = SOAP::Serializer->method( # same as ->envelope(method =>
SOAP::Data->name('mymethod')->attr({something => 'value'}), 1, 2, 3,
);
ok($serialized =~ //);
$serialized = SOAP::Serializer
-> envprefix('')
-> method('mymethod');
ok($serialized =~ m!!);
$deserialized = SOAP::Deserializer->deserialize('1');
ok(! defined $deserialized->namespaceuriof('//getStateName'));
$deserialized = SOAP::Deserializer->deserialize('1');
ok($deserialized->namespaceuriof('//getStateName') eq 'a');
}
{ # Map type serialization/deserialization
print "Map type serialization/deserialization test(s)...\n";
my $key = "\0\1";
$serialized = SOAP::Serializer->method(aa => SOAP::Data->type(map => {a => 123, $key => 456})->name('maaap'));
{ local $^W; # disable warning on implicit map encoding
my $implicit = SOAP::Serializer->method(aa => SOAP::Data->name(maaap => {a => 123, $key => 456}));
ok($implicit eq $serialized);
}
ok($serialized =~ /apachens:Map/);
ok($serialized =~ m!xmlns:apachens="http://xml.apache.org/xml-soap"!);
$deserialized = SOAP::Deserializer->deserialize($serialized);
$a = $deserialized->valueof('//maaap');
ok(UNIVERSAL::isa($a => 'HASH'));
ok(ref $a && $a->{$key} == 456);
}
{ # Stringified type serialization
print "Stringified type serialization test(s)...\n";
$serialized = SOAP::Serializer->serialize(bless { a => 1, _current => [] } => 'SOAP::SOM');
my $test = $serialized;
ok $test =~s{
<\?xml \s version="1.0" \s encoding="UTF-8"\?>
}{}xms;
ok $test =~s{
\z
}{}xms;
ok $test =~s{ 1 }{}xms;
ok $test =~s{ <_current (:?
\s soapenc:arrayType="xsd:anyType\[0\]"
| \s xsi:type="soapenc:Array" ){2}
\s/>
}{}xms;
ok length $test == 0;
# Replaced complex regex by several simpler (see above).
# ok($serialized =~ m!1<_current(?: soapenc:arrayType="xsd:anyType\[0\]"| xsi:type="soapenc:Array"){2} />!);
# ok( ($serialized =~ m!1<_current(?: soapenc:arrayType="xsd:anyType\[0\]"| xsi:type="soapenc:Array"){2}/>!)
# || ($serialized =~ m!<_current(?: soapenc:arrayType="xsd:anyType\[0\]"| xsi:type="soapenc:Array"){2}/>1!));
#print $serialized;
# exit;
$serialized =~ s/__/./g; # check for SOAP.SOM instead of SOAP__SOM
ok(ref SOAP::Deserializer->deserialize($serialized)->root eq 'SOAP::SOM');
}
{ # Serialization of non-allowed element
print "Serialization of non-allowed element test(s)...\n";
eval { $serialized = SOAP::Serializer->serialize(SOAP::Data->name('---' => 'aaa')) };
ok($@ =~ /^Element/);
}
{ # Custom serialization of blessed reference
print "Custom serialization of blessed reference test(s)...\n";
eval q!
sub SOAP::Serializer::as_My__Own__Class {
my $self = shift;
my($value, $name, $type, $attr) = @_;
return [$name, {%{$attr || {}}, 'xsi:type' => 'xsd:string'}, join ', ', map {"$_ => $value->{$_}"} sort keys %$value];
}
1;
! or die;
$serialized = SOAP::Serializer->serialize(bless {a => 1, b => 2} => 'My::Own::Class');
ok($serialized =~ m!a => 1, b => 2!);
}
{ # Multirefs serialization
print "Multirefs serialization test(s)...\n";
my $b = { b => 2 };
my $a = { a => $b };
my $c = { c1 => $a, c2 => $a };
$serialized = SOAP::Serializer->autotype(0)->method(a => $c);
ok($serialized =~ m!2! ||
$serialized =~ m!2! ||
$serialized =~ m!2! ||
$serialized =~ m!2!);
$serialized = SOAP::Serializer->autotype(0)->namespaces({})->serialize($c);
ok($serialized =~ m!2! ||
$serialized =~ m!2! ||
$serialized =~ m!2! ||
$serialized =~ m!2!);
my $root = SOAP::Deserializer->deserialize($serialized)->root;
ok($root->{c1}->{a}->{b} == 2);
ok($root->{c2}->{a}->{b} == 2);
}
{ # Serialization of multirefs shared between Header and Body
print "Serialization of multirefs shared between Header and Body test(s)...\n";
$a = { b => 2 };
print $serialized = SOAP::Serializer->autotype(0)->method(a => SOAP::Header->value($a), $a);
print "\n";
print '2', "\n";
ok($serialized =~ m!2!);
}
{ # Deserialization with typecast
print "Deserialization with typecast test(s)...\n";
my $desc = 0;
my $typecasts = 0;
eval {
package MyDeserializer;
@MyDeserializer::ISA = 'SOAP::Deserializer';
sub typecast;
*typecast = sub { shift;
my($value, $name, $attrs, $children, $type) = @_;
$desc = "$name @{[scalar @$children]}" if $name eq 'a';
$typecasts++;
return;
};
1;
} or die;
$deserialized = MyDeserializer->deserialize('12');
ok($desc eq 'a 2'); #! fix "if $name eq 'a'", because $name is QName now ('{}a')
ok($typecasts == 5);
}
{ # Deserialization with wrong encodingStyle
print "Deserialization with wrong encodingStyle test(s)...\n";
eval { $deserialized = SOAP::Deserializer->deserialize(
'1') };
ok(!$@ && $deserialized);
eval { $deserialized = SOAP::Deserializer->deserialize(
'1') };
ok(!$@ && $deserialized);
eval { $deserialized = SOAP::Deserializer->deserialize(
'1') };
ok(!$@ && $deserialized);
eval { $deserialized = SOAP::Deserializer->deserialize(
'1') };
ok(!$@ && $deserialized);
eval { $deserialized = SOAP::Deserializer->deserialize(
'1') };
ok(!$@ && $deserialized);
}
{ # Deserialization with root attribute
print "Deserialization with root attribute test(s)...\n";
# root="0", should skip
$deserialized = SOAP::Deserializer->deserialize('
12
');
ok($deserialized->result == 2);
# root="0", but in wrong namespace
$deserialized = SOAP::Deserializer->deserialize('
12
');
ok($deserialized->result == 1);
# root="1"
$deserialized = SOAP::Deserializer->deserialize('
1234
');
ok($deserialized->result == 1);
ok($deserialized->valueof('//{http://www.soaplite.com/2}doublerResponse2/nums') == 2);
ok($deserialized->valueof('//{http://www.soaplite.com/3}doublerResponse2/nums') == 3);
ok($deserialized->valueof('//{}doublerResponse2/nums') == 4);
my @nums = $deserialized->valueof('//doublerResponse2/nums');
ok(@nums == 3);
ok($nums[0] == 2 && $nums[1] == 3);
my $body = $deserialized->body;
ok(ref $body->{doublerResponse1} && ref $body->{doublerResponse2});
}
{
print "Deserialization with null elements test(s)...\n";
$deserialized = SOAP::Deserializer->deserialize('
1257
')->result;
ok(scalar @$deserialized == 7);
ok(! defined $deserialized->[2]);
ok(! defined $deserialized->[3]);
ok($deserialized->[5] eq '');
}
{
print "Serialization of list with undef elements test(s)...\n";
$serialized = SOAP::Serializer->method(a => undef, 1, undef, 2);
my(@r) = SOAP::Deserializer->deserialize($serialized)->paramsall;
ok(2 == grep {!defined} @r);
}
{
print "Deserialization with xsi:type='string' test(s)...\n";
$a = 'SOAP::Lite';
$deserialized = SOAP::Deserializer->deserialize(qq!$a!)->root;
ok($deserialized eq $a);
}
{
print "Deserialization with typing inherited from Array element test(s)...\n";
$deserialized = SOAP::Deserializer->deserialize('
MTIzMTIz')->root;
ok(scalar @$deserialized == 3);
ok($deserialized->[0] eq 'MTIz');
ok($deserialized->[1] eq 123);
ok($deserialized->[2] eq '');
}
{
print "Serialization with explicit typing test(s)...\n";
$serialized = SOAP::Serializer
->method(a => SOAP::Data->name('return')->type(int => 1));
ok($serialized =~ /xsd:int/);
eval {
$serialized = SOAP::Serializer
->method(a => SOAP::Data->name('return')->type(noint => 1));
};
ok($@ =~ /for type 'noint' is not specified/);
}
{
print "Serialization w/out explicit typing test(s)...\n";
$a = { a => 'false' };
$serialized = SOAP::Serializer->namespaces({})->serialize($a);
### 'false' evaluated as a boolean should still be false after the evaluation.
ok($serialized =~ m!false!);
$a = { a => 'true' };
$serialized = SOAP::Serializer->namespaces({})->serialize($a);
### 'false' evaluated as a boolean should still be false after the evaluation.
ok($serialized =~ m!true!);
}
{
print "Serialization with explicit namespaces test(s)...\n";
$serialized = SOAP::Serializer->serialize(SOAP::Data->name('b' => 1));
ok($serialized =~ m!serialize(SOAP::Data->name('c:b' => 1));
ok($serialized =~ m!serialize(SOAP::Data->name('{a}b' => 1));
ok($serialized =~ m!serialize(SOAP::Data->name('{}b' => 1));
ok($serialized =~ m!1' ],
[ undef, '', '1' ],
[ undef, 'a', '<(namesp\d+):b xmlns:\1="a">1\1:b>' ],
[ '', undef, '1' ],
[ '', '', '1' ],
[ '', 'a', '1' ],
[ 'c', undef, '1' ],
[ 'c', '', '1' ],
[ 'c', 'a', '1' ],
);
my $serializer = SOAP::Serializer->autotype(0)->namespaces({});
my $deserializer = SOAP::Deserializer->new;
my $testnum = 0;
foreach (@prefix_uri_tests) {
$testnum++;
my($prefix, $uri, $test) = @$_;
my $res = $serializer->serialize(
SOAP::Data->name('b')->prefix($prefix)->uri($uri)->value(1)
);
ok($res =~ /$test/);
next unless $testnum =~ /^([4569])$/;
my $data = $deserializer->deserialize($res)->dataof(SOAP::SOM::root);
ok(defined $prefix ? defined $data->prefix && $data->prefix eq $prefix
: !defined $data->prefix);
ok(defined $uri ? defined $data->uri && $data->uri eq $uri
: !defined $data->uri);
}
}
{
print "Deserialization for different SOAP versions test(s)...\n";
my $version = SOAP::Lite->soapversion;
$a = q!
135!;
SOAP::Lite->soapversion(1.1);
$deserialized = SOAP::Deserializer->deserialize($a);
ok(ref $deserialized->result eq 'ARRAY');
SOAP::Lite->soapversion(1.2);
$deserialized = SOAP::Deserializer->deserialize($a);
ok(ref $deserialized->result eq 'ARRAY');
SOAP::Lite->soapversion($version);
}
{
print "Deserialization of multidimensional array of array test(s)...\n";
$a = q!
123456789101112!;
$deserialized = SOAP::Deserializer->deserialize($a)->result;
# [
# [
# ['1', '2', '3'],
# ['4', '5', '6']
# ],
# [
# ['7', '8', '9'],
# ['10', '11', '12']
# ]
# ]
ok(ref $deserialized eq 'ARRAY');
ok(@$deserialized == 2);
ok(@{$deserialized->[0]} == 2);
ok(@{$deserialized->[0]->[0]} == 3);
ok($deserialized->[0]->[0]->[2] == 3);
}
{
print "Serialization without specified typemapping test(s)...\n";
$serialized = SOAP::Serializer->method(a => bless {a => 1} => 'A');
ok($serialized =~ m!!);
ok($serialized =~ m!^<\?xml!); # xml declaration
# higly questionably, but that's how it is
$serialized = SOAP::Serializer->encoding(undef)->method(a => bless {a => 1} => 'A');
ok($serialized =~ m!!);
ok($serialized !~ m!^<\?xml!); # no xml declaration
}
{
print "Deserialization with different XML Schemas on one element test(s)...\n";
my $deserializer = SOAP::Deserializer->new;
$deserializer->deserialize(q!Simple Test String!);
ok($deserializer->xmlschema eq 'http://www.w3.org/1999/XMLSchema');
$deserializer->deserialize(q!Simple Test String!);
ok($deserializer->xmlschema eq 'http://www.w3.org/2001/XMLSchema');
}
{
print "SOAP::Fault stringification test(s)...\n";
my $f = SOAP::Fault->faultcode('Client.Authenticate')
->faultstring('Bad error');
ok($f eq 'Client.Authenticate: Bad error');
}
{
print "Memory leaks test(s)...\n"; # also check 36-leaks.t
my %calls;
{
SOAP::Lite->import(trace => [objects => sub {
if ((caller(2))[3] =~ /^(.+)::(.+)$/) {
$calls{$2}{$1}++;
}
}]);
my $soap = SOAP::Lite
-> uri("Echo")
-> proxy("http://services.soaplite.com/echo.cgi");
}
foreach (keys %{$calls{new}}) {
ok(exists $calls{DESTROY}{$_});
}
%calls = ();
{
local $SOAP::Constants::DO_NOT_USE_XML_PARSER = 1;
my $soap = SOAP::Lite
-> uri("Echo")
-> proxy("http://services.soaplite.com/echo.cgi");
}
foreach (keys %{$calls{new}}) {
ok(exists $calls{DESTROY}{$_});
}
SOAP::Lite->import(trace => '-objects');
}
SOAP-Lite-1.09/t/03-server.t 000644 000766 000024 00000025046 12156373142 016431 0 ustar 00fredmoyer staff 000000 000000 #!/bin/env perl
BEGIN {
unless(grep /blib/, @INC) {
chdir 't' if -d 't';
unshift @INC, '../lib' if -d '../lib';
}
}
use strict;
use Test;
BEGIN { plan tests => 32 }
use SOAP::Lite;
my($a, $s, $r, $serialized, $deserialized);
my %tests = (
'XML only' => <<'EOM',
25
EOM
'message with headers' => <<'EOM',
Content-Type: text/xml
25
EOM
'singlepart MIME' => <<'EOM',
Content-Type: Multipart/Related; boundary=MIME_boundary; type="text/xml"; start=""
--MIME_boundary
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-ID: 25
--MIME_boundary--
EOM
'multipart MIME' => <<'EOM',
Content-Type: Multipart/Related; boundary=MIME_boundary; type="text/xml"; start=""
--MIME_boundary
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-ID: 25
--MIME_boundary
Content-Type: text/plain
Content-Transfer-Encoding: binary
Content-ID:
2
--MIME_boundary
Content-Type: text/plain
Content-Transfer-Encoding: binary
Content-ID:
5
--MIME_boundary--
EOM
'multipart MIME w/multiref' => <<'EOM',
Content-Type: Multipart/Related; boundary=MIME_boundary; type="text/xml"; start=""
--MIME_boundary
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-ID:
--MIME_boundary
Content-Type: text/plain
Content-Transfer-Encoding: binary
Content-ID:
2
--MIME_boundary
Content-Type: text/plain
Content-Transfer-Encoding: binary
Content-ID:
5
--MIME_boundary--
EOM
);
eval "SOAP::Packager::MIME->new->initialize_parser();";
my $is_mimetools_installed = ($@) ? 0 : 1;
(my $reason = $@) =~ s/ at .+// unless $is_mimetools_installed;
print "MIME tests will be skipped: $reason" if defined $reason;
my $package = '
package Calculator;
sub new { bless {} => ref($_[0]) || $_[0] }
sub add { $_[1] + $_[2] }
sub schema { $SOAP::Constants::DEFAULT_XML_SCHEMA }
1;';
# TEST 1-4
HANDLER: {
print "Server handler test(s)...\n";
my $server = SOAP::Server->dispatch_to('Calculator');
SKIP: for (reverse sort keys %tests) {
#print $_, "\n";
my $result = SOAP::Deserializer->deserialize($server->handle($tests{$_}));
skip(1, 'skip')
if ($_ =~m/XML/ || !$is_mimetools_installed)
|| ($result->faultstring || '') =~ /Failed to access class \(Calculator\)/;
#print $result->faultstring;
#print "SKIP\n";
}
eval $package or die;
SKIP: for (reverse sort keys %tests) {
my $result = SOAP::Deserializer->deserialize($server->handle($tests{$_}));
if ($_ =~m/XML/ || !$is_mimetools_installed) {
skip(1, 'skip');
next SKIP;
}
ok (($result->result || 0) == 7);
}
}
{
print "Server handler with complex dispatches test(s)...\n";
foreach my $server (
# dispatch to class
SOAP::Server->dispatch_to('Calculator'),
# dispatch to object
SOAP::Server->dispatch_to(Calculator->new),
# dispatch to regexp
SOAP::Server->dispatch_to('Calc\w+'),
# dispatch URI to class
SOAP::Server->dispatch_with({'http://www.soaplite.com/Calculator' => 'Calculator'}),
# dispatch URI to object
SOAP::Server->dispatch_with({'http://www.soaplite.com/Calculator' => Calculator->new}),
# dispatch quoted SOAPAction to class
SOAP::Server->action('"http://action/#method"')
->dispatch_with({'http://action/#method' => 'Calculator'}),
# dispatch non-quoted SOAPAction to class
SOAP::Server->action('http://action/#method')
->dispatch_with({'http://action/#method' => 'Calculator'}),
# dispatch to class and BAD regexp.
SOAP::Server->dispatch_to('\protocols', 'Calculator')
) { # end for
my $result = SOAP::Deserializer->deserialize($server->handle($tests{'XML only'}));
my $value = $result->result;
use Data::Dumper; print Dumper $value;
ok($value + 0 == 7);
}
}
{
print "Error handling in server test(s)...\n";
$a = SOAP::Server->handle('');
ok($a =~ /Can't find root/);
$a = SOAP::Server->handle('');
ok($a =~ /Can't find method/);
$a = SOAP::Server->handle('11');
ok($a =~m{Denied \s access \s to \s method}x);
$a = SOAP::Server->handle('');
ok($a =~ /Can't find method/);
}
{
print "Envelope with no namespaces test(s)...\n";
eval 'sub add { $_[1] + $_[2] }; 1' or die;
my $result = SOAP::Deserializer->deserialize(SOAP::Server->dispatch_to('add')->handle('34'));
ok(($result->result || 0) == 7);
}
{
print "Different XML Schemas test(s)...\n";
my $server = SOAP::Server->dispatch_to('Calculator');
$a = $server->handle('');
ok($a =~ m!xsi="http://www.w3.org/2001/XMLSchema-instance"!);
ok($a =~ m!xsd="http://www.w3.org/2001/XMLSchema"!);
ok($a =~ m!>http://www.w3.org/2001/XMLSchemahandle('2');
ok($a =~ m!xsi="http://www.w3.org/2001/XMLSchema-instance"!);
ok($a =~ m!xsd="http://www.w3.org/2001/XMLSchema"!);
ok($a =~ m!>http://www.w3.org/2001/XMLSchemahandle('2');
ok($a =~ m!xsi="http://www.w3.org/2001/XMLSchema-instance"!);
ok($a =~ m!xsd="http://www.w3.org/2001/XMLSchema"!);
ok($a =~ m!>http://www.w3.org/2001/XMLSchema