import SOAP-WSDL 2.00_09 from CPAN

git-cpan-module:   SOAP-WSDL
git-cpan-version:  2.00_09
git-cpan-authorid: MKUTTER
git-cpan-file:     authors/id/M/MK/MKUTTER/SOAP-WSDL-2.00_09.tar.gz
This commit is contained in:
Martin Kutter
2007-08-12 05:15:39 -08:00
committed by Michael G. Schwern
parent 312f3d6bbd
commit a554e87f49
29 changed files with 1041 additions and 399 deletions

View File

@@ -1,8 +1,9 @@
use Module::Build;
Module::Build->new(
# create_makefile_pl => 'traditional',
dist_abstract => 'SOAP with WSDL support',
dist_name => 'SOAP-WSDL',
dist_version => '2.00_08',
dist_version => '2.00_09',
module_name => 'SOAP::WSDL',
license => 'artistic',
requires => {

591
CHANGES
View File

@@ -1 +1,590 @@
See perldoc SOAP::WSDL
------------------------------------------------------------------------
r131 | kutterma | 2007-08-12 14:18:59 +0200 (So, 12 Aug 2007) | 3 lines
- fixed documentation for generated code with element ref="" declarations
- fixed element ref="" test for generated code
- added (generated) Makefile.PL to make CPAN testers happy
------------------------------------------------------------------------
r130 | kutterma | 2007-08-10 15:57:12 +0200 (Fr, 10 Aug 2007) | 1 line
- first try at truely callback-based parser (inspired by XML::Compile)
------------------------------------------------------------------------
r129 | kutterma | 2007-08-07 17:53:40 +0200 (Di, 07 Aug 2007) | 1 line
- moved duplicate sub generation out of loop
------------------------------------------------------------------------
r128 | kutterma | 2007-08-07 14:16:28 +0200 (Di, 07 Aug 2007) | 1 line
- bool now returns numerical value in bool context, not "true" or "false" (always true...)
------------------------------------------------------------------------
r127 | kutterma | 2007-08-07 11:45:23 +0200 (Di, 07 Aug 2007) | 1 line
- fixed test to be timezone sensitive
------------------------------------------------------------------------
r126 | kutterma | 2007-08-07 11:09:51 +0200 (Di, 07 Aug 2007) | 1 line
- made test timezone-sensitive
------------------------------------------------------------------------
r125 | kutterma | 2007-08-07 11:09:16 +0200 (Di, 07 Aug 2007) | 1 line
- made test timezone-sensitive
------------------------------------------------------------------------
r124 | kutterma | 2007-08-06 18:05:02 +0200 (Mo, 06 Aug 2007) | 2 lines
- fixed element ref handling in code generator in ComplexType.
- top-level element ref still not supported/tested
------------------------------------------------------------------------
r123 | kutterma | 2007-08-06 17:48:57 +0200 (Mo, 06 Aug 2007) | 1 line
- test now dies and outputs code to eval on eval errors
------------------------------------------------------------------------
r122 | kutterma | 2007-08-06 17:29:46 +0200 (Mo, 06 Aug 2007) | 1 line
- fixed element ref="" handling in complexType
------------------------------------------------------------------------
r121 | kutterma | 2007-08-06 17:29:14 +0200 (Mo, 06 Aug 2007) | 1 line
- added test data for element ref inside complexType
------------------------------------------------------------------------
r120 | kutterma | 2007-08-06 17:28:54 +0200 (Mo, 06 Aug 2007) | 1 line
- added test for element ref inside complexType
------------------------------------------------------------------------
r119 | kutterma | 2007-08-06 17:13:03 +0200 (Mo, 06 Aug 2007) | 1 line
- fixed element ref handling
------------------------------------------------------------------------
r118 | kutterma | 2007-08-06 17:12:47 +0200 (Mo, 06 Aug 2007) | 1 line
- added element ref test data
------------------------------------------------------------------------
r117 | kutterma | 2007-08-06 17:12:36 +0200 (Mo, 06 Aug 2007) | 1 line
- added element ref test
------------------------------------------------------------------------
r116 | kutterma | 2007-08-06 15:47:30 +0200 (Mo, 06 Aug 2007) | 1 line
- refined docs
------------------------------------------------------------------------
r115 | kutterma | 2007-08-06 15:39:39 +0200 (Mo, 06 Aug 2007) | 1 line
- updated docs. Hope the CPAN indexer ignores "=for developers"...
------------------------------------------------------------------------
r114 | kutterma | 2007-08-06 14:12:28 +0200 (Mo, 06 Aug 2007) | 1 line
- removed annoying pod
------------------------------------------------------------------------
r113 | kutterma | 2007-08-05 18:42:09 +0200 (So, 05 Aug 2007) | 5 lines
- removed SOAP::Lite dependency
- updated docs
- changed SOAP::WSDL::XSD::Typelib::ComplexType to require the actuall class for element data, not just the base class (good for finding errors earlier)
- implemented returning SOAP::SOM objects in SOAP::WSDL
- added SOAP::WSDL example(weather_wsdl.pl)
------------------------------------------------------------------------
r112 | kutterma | 2007-08-03 16:12:57 +0200 (Fr, 03 Aug 2007) | 1 line
updated docs
------------------------------------------------------------------------
r111 | kutterma | 2007-08-03 16:12:04 +0200 (Fr, 03 Aug 2007) | 1 line
- added "skip"
------------------------------------------------------------------------
r110 | kutterma | 2007-07-31 22:27:25 +0200 (Di, 31 Jul 2007) | 2 lines
- further work on removing SOAP::Lite dependency
- Note: SOAP::WSDL may be broken !
------------------------------------------------------------------------
r109 | kutterma | 2007-07-31 21:10:40 +0200 (Di, 31 Jul 2007) | 3 lines
- finished move from XSD::Primitive to Builtin
- fixed a few tests
- removed typo namespace from TypeLookupt
------------------------------------------------------------------------
r108 | kutterma | 2007-07-31 21:02:43 +0200 (Di, 31 Jul 2007) | 1 line
- removed unneeded example stuff
------------------------------------------------------------------------
r107 | kutterma | 2007-07-31 20:32:43 +0200 (Di, 31 Jul 2007) | 1 line
- rename to Builtin
------------------------------------------------------------------------
r106 | kutterma | 2007-07-31 20:32:11 +0200 (Di, 31 Jul 2007) | 1 line
- prepared rename to Builtin
------------------------------------------------------------------------
r105 | kutterma | 2007-07-31 13:17:52 +0200 (Di, 31 Jul 2007) | 2 lines
- added configurable ContentType / charset
- maybe split up charset and content type into two methods ?
------------------------------------------------------------------------
r104 | kutterma | 2007-07-31 00:16:15 +0200 (Di, 31 Jul 2007) | 3 lines
- removed optional nanoseconds from dateTime conversions
- added conversion to date objects
- removed fetching WSDL via SOAP::Schema in SOAP::WSDL. SOAP::Lite is still used as base class.
------------------------------------------------------------------------
r103 | kutterma | 2007-07-30 13:25:06 +0200 (Mo, 30 Jul 2007) | 1 line
- updated TODO
------------------------------------------------------------------------
r102 | kutterma | 2007-07-30 13:23:09 +0200 (Mo, 30 Jul 2007) | 2 lines
- updated Build.PL dependencies
- update TODO
------------------------------------------------------------------------
r101 | kutterma | 2007-07-30 13:22:05 +0200 (Mo, 30 Jul 2007) | 2 lines
- added dateTime test
- fixed pod test
------------------------------------------------------------------------
r100 | kutterma | 2007-07-27 16:03:15 +0200 (Fr, 27 Jul 2007) | 2 lines
- allow passing list refs of hash refs to set_value.
I hope I got all combinations by now - start getting ugly...
------------------------------------------------------------------------
r99 | kutterma | 2007-07-26 23:18:35 +0200 (Do, 26 Jul 2007) | 1 line
- added SOAP::Lite usage (to be removed later)
------------------------------------------------------------------------
r98 | kutterma | 2007-07-26 23:16:30 +0200 (Do, 26 Jul 2007) | 3 lines
- removed SOAP::Lite dependency
- added set_trace and tracing facility support via callback in call()
- added fault_class property to allow different Fault classes (somewhen later on)
------------------------------------------------------------------------
r97 | kutterma | 2007-07-25 16:59:49 +0200 (Mi, 25 Jul 2007) | 3 lines
- dateTime now converts date strings into XML date strings
- updated docs
------------------------------------------------------------------------
r96 | kutterma | 2007-07-23 11:17:36 +0200 (Mo, 23 Jul 2007) | 3 lines
- SOAP::WSDL::Definitions::create now
- converts '.' in service names to '::' (.NET class separator to perl class separator)
- outputs Typemaps and Interface classes in UTF8 to allow proper inclusion of UTF8 documentation from WSDL
------------------------------------------------------------------------
r95 | kutterma | 2007-07-23 10:26:59 +0200 (Mo, 23 Jul 2007) | 1 line
- typo
------------------------------------------------------------------------
r94 | kutterma | 2007-07-23 10:11:46 +0200 (Mo, 23 Jul 2007) | 1 line
- typo
------------------------------------------------------------------------
r93 | kutterma | 2007-07-22 23:24:12 +0200 (So, 22 Jul 2007) | 1 line
updated TODO
------------------------------------------------------------------------
r92 | kutterma | 2007-07-22 23:19:15 +0200 (So, 22 Jul 2007) | 3 lines
- WSDLHandler now handles <wsdl:documentation> tags
- SOAP::WSDL::Definitions now includes some usable doc in generated interface classes
- fixed explain in SimpleType, ComplexType and Element (someway)
------------------------------------------------------------------------
r91 | kutterma | 2007-07-22 21:18:21 +0200 (So, 22 Jul 2007) | 1 line
- updated docs
------------------------------------------------------------------------
r90 | kutterma | 2007-07-22 15:42:23 +0200 (So, 22 Jul 2007) | 1 line
- updated docs
------------------------------------------------------------------------
r89 | kutterma | 2007-07-22 15:38:25 +0200 (So, 22 Jul 2007) | 2 lines
- updated docs
- removed useless docs from "internally used only" - modules
------------------------------------------------------------------------
r88 | kutterma | 2007-07-22 09:17:57 +0200 (So, 22 Jul 2007) | 1 line
typo
------------------------------------------------------------------------
r87 | kutterma | 2007-07-21 23:57:46 +0200 (Sa, 21 Jul 2007) | 1 line
- updated docs
------------------------------------------------------------------------
r86 | kutterma | 2007-07-21 23:24:24 +0200 (Sa, 21 Jul 2007) | 5 lines
- removed irritating pod from SOAP::WSDL::XSD::Typelib::Builtin::* classes and put int into SOAP::WSDL::XSD::Typelib::Builtin
- added fast constructor creation BEGIN block to all SOAP::WSDL::XSD::Typelib::Builtin::* classes
- added examples
- updated docs
- prepared 2.00_07 pre-release
------------------------------------------------------------------------
r85 | kutterma | 2007-07-21 18:12:49 +0200 (Sa, 21 Jul 2007) | 4 lines
- added wsdl2perl code generation script - works against FortuneCookie web service at fullerdata.com
- fixed SOAP::WSDL::Client::Base to work as base class for generated classes
- added interface generation facility to SOAP::WSDL::Definitions
- updated docs (a few)
------------------------------------------------------------------------
r84 | kutterma | 2007-07-20 15:37:40 +0200 (Fr, 20 Jul 2007) | 9 lines
- added Expat-based parser
- made Expat-based parser the default
- added fast "new" method to most important "Builtin" types
- added Parser POD
- fixed propagating element names in complex types to element elements - element ref="element" should work on
class level now (don't know whether typelib supports it yet)
- updated tests
- updated HACKING
- prepared 2.00_06 release
------------------------------------------------------------------------
r83 | kutterma | 2007-07-19 13:09:33 +0200 (Do, 19 Jul 2007) | 1 line
- fixed element class generation (removed additional ::)
------------------------------------------------------------------------
r82 | kutterma | 2007-07-17 22:17:02 +0200 (Di, 17 Jul 2007) | 1 line
- updated README and HACKING
------------------------------------------------------------------------
r81 | kutterma | 2007-07-17 22:00:14 +0200 (Di, 17 Jul 2007) | 5 lines
- added parent ref in SOAP::WSDL::Base - now we have a real tree, and maybe can completely support namespaces some day
- replaced grep by List::Util::first where appropriate
- code cleanup
- fixed test for Code Generation
- updated a few tests
------------------------------------------------------------------------
r80 | kutterma | 2007-07-17 17:00:48 +0200 (Di, 17 Jul 2007) | 1 line
- improved pod in generated classes
------------------------------------------------------------------------
r79 | kutterma | 2007-07-17 14:41:44 +0200 (Di, 17 Jul 2007) | 1 line
- made explain look nicer
------------------------------------------------------------------------
r78 | kutterma | 2007-07-15 12:25:03 +0200 (So, 15 Jul 2007) | 7 lines
- SOAP::WSDL::Definitions can now generate
- Typemaps
- Type and Element classes
- fixed SOAP::WSDL::XSD::Typelib::ComplexType to support elements with type="ComplexType" definitions
- moved toClass method in SOAP::WSDL::XSD::ComplexType, Element and SimpleType to to_class and added compatibility wrapper with warning for toClass calls
- added generator test
- updated docs
------------------------------------------------------------------------
r77 | kutterma | 2007-07-14 10:46:54 +0200 (Sa, 14 Jul 2007) | 1 line
- started working on high-level code generator
------------------------------------------------------------------------
r76 | kutterma | 2007-07-13 09:21:33 +0200 (Fr, 13 Jul 2007) | 1 line
- fixed handling of complex data (hashes with lists embedded lists of objects)
------------------------------------------------------------------------
r75 | kutterma | 2007-07-10 12:08:39 +0200 (Di, 10 Jul 2007) | 1 line
- removed unneeded SOAP::Lite calls
------------------------------------------------------------------------
r74 | kutterma | 2007-07-10 12:08:10 +0200 (Di, 10 Jul 2007) | 1 line
- updated to new SOAP::Lite API
------------------------------------------------------------------------
r73 | kutterma | 2007-07-10 12:00:25 +0200 (Di, 10 Jul 2007) | 6 lines
- re-integrated old SOAP::WSDL tests
- updated docs
- SOAP::WSDL::XSD::Typelib::Builtin::string now escapes XML builtin entities on serialization
- SOAP::WSDL::XSD::Element now supports generating classes for elements and types into different namespaces
- SOAP::WSDL::Definitions now supports different namespaces for elements and types when generating typmaps
- 2.00_05 release preparation
------------------------------------------------------------------------
r72 | kutterma | 2007-07-06 11:20:56 +0200 (Fr, 06 Jul 2007) | 1 line
- fixed detail (typo)
------------------------------------------------------------------------
r71 | kutterma | 2007-07-05 16:13:28 +0200 (Do, 05 Jul 2007) | 1 line
- TODO comments added
------------------------------------------------------------------------
r70 | kutterma | 2007-07-04 16:14:50 +0200 (Mi, 04 Jul 2007) | 2 lines
- updated docs
- prepared 2.00_04 release
------------------------------------------------------------------------
r69 | kutterma | 2007-07-04 16:07:54 +0200 (Mi, 04 Jul 2007) | 1 line
- ComplexType now ignores xmlns - TODO: check xmlns, don't ignore...
------------------------------------------------------------------------
r68 | kutterma | 2007-07-04 11:25:31 +0200 (Mi, 04 Jul 2007) | 1 line
- made builtin types with overloads serializable
------------------------------------------------------------------------
r67 | kutterma | 2007-07-04 09:51:06 +0200 (Mi, 04 Jul 2007) | 4 lines
- updated docs
- removed unneeded uses from test
- added Build requirements from tests
- prepared 2.00_03 release
------------------------------------------------------------------------
r66 | kutterma | 2007-07-04 00:06:29 +0200 (Mi, 04 Jul 2007) | 3 lines
- split up builtin type lib into single files for Class::Std::Storable
- fixed more tests
- fixed complexType serialization for non-objecs
------------------------------------------------------------------------
r65 | kutterma | 2007-07-03 16:52:54 +0200 (Di, 03 Jul 2007) | 2 lines
- fixed a few tests
- added performance improvements
------------------------------------------------------------------------
r64 | kutterma | 2007-07-03 15:09:27 +0200 (Di, 03 Jul 2007) | 1 line
- small performance improvements
------------------------------------------------------------------------
r63 | kutterma | 2007-07-03 14:37:28 +0200 (Di, 03 Jul 2007) | 3 lines
- fixed serializing complextypes correctly
- fixed handling has attribute refs in new
- fixed performance problems in MessageHandler
------------------------------------------------------------------------
r62 | kutterma | 2007-07-03 14:37:14 +0200 (Di, 03 Jul 2007) | 1 line
- re-added
------------------------------------------------------------------------
r61 | kutterma | 2007-07-03 14:36:59 +0200 (Di, 03 Jul 2007) | 1 line
------------------------------------------------------------------------
r60 | kutterma | 2007-07-01 09:52:41 +0200 (So, 01 Jul 2007) | 2 lines
- fixed lots of tests
- attic tests may be re-integrated now...
------------------------------------------------------------------------
r59 | kutterma | 2007-06-28 13:07:35 +0200 (Do, 28 Jun 2007) | 1 line
- added ignore for dist tar.gz
------------------------------------------------------------------------
r58 | kutterma | 2007-06-28 13:06:25 +0200 (Do, 28 Jun 2007) | 1 line
- updated buildrequires
------------------------------------------------------------------------
r57 | kutterma | 2007-06-28 13:05:03 +0200 (Do, 28 Jun 2007) | 1 line
- typo
------------------------------------------------------------------------
r56 | kutterma | 2007-06-28 11:15:24 +0200 (Do, 28 Jun 2007) | 1 line
- pre-release 2.00_01
------------------------------------------------------------------------
r55 | kutterma | 2007-06-28 10:23:20 +0200 (Do, 28 Jun 2007) | 1 line
- moved old tests to attic
------------------------------------------------------------------------
r54 | kutterma | 2007-06-28 10:15:41 +0200 (Do, 28 Jun 2007) | 1 line
- fixed a few typos
------------------------------------------------------------------------
r53 | kutterma | 2007-06-28 10:10:41 +0200 (Do, 28 Jun 2007) | 3 lines
- fixed MessageHandler to support deserializing into objects which return false in boolean context
- updated docs
- fixed Fault11 (named detail correctly)
------------------------------------------------------------------------
r52 | kutterma | 2007-06-27 17:36:01 +0200 (Mi, 27 Jun 2007) | 3 lines
- added Fault for SOAP 1.1 implementation
- fixed ComplexType - though it doesn't work quite for faults yet...
------------------------------------------------------------------------
r51 | kutterma | 2007-06-27 13:27:59 +0200 (Mi, 27 Jun 2007) | 13 lines
- added test for sending objects via call()
- modified Client to accept objects of type SOAP::WSDL::XSD::Typelib::Builtin::anyType as message content
without checking the WSDL objects
Note:
- SOAPAction is just guessed - needs to be replaced by something better
- The method should be looked up from the typelib, too, and serialized according to the rules specified in the WSDL
and dumped into the typelib.
- updated to_typelib to include top element
- fixed element and complextype templates for toClass
------------------------------------------------------------------------
r50 | kutterma | 2007-06-27 00:01:32 +0200 (Mi, 27 Jun 2007) | 1 line
- added xsi xmlns to envelope
------------------------------------------------------------------------
r49 | kutterma | 2007-06-26 23:52:18 +0200 (Di, 26 Jun 2007) | 1 line
- cosmetics and a few doc updates
------------------------------------------------------------------------
r48 | kutterma | 2007-06-26 22:47:52 +0200 (Di, 26 Jun 2007) | 2 lines
- refactored element serializing to make it somewhat more consistent
- added nillable implementation for Elements
------------------------------------------------------------------------
r47 | kutterma | 2007-06-26 18:06:59 +0200 (Di, 26 Jun 2007) | 1 line
- removed shebang
------------------------------------------------------------------------
r46 | kutterma | 2007-06-26 18:06:33 +0200 (Di, 26 Jun 2007) | 1 line
- added warnings
------------------------------------------------------------------------
r45 | kutterma | 2007-06-26 17:39:09 +0200 (Di, 26 Jun 2007) | 3 lines
- got toClass working for generating WSDL based type libraries.
- changed typelib base class behavior to qualify first element called.
TODO (a bigger one): Fully support namespaces...
------------------------------------------------------------------------
r44 | kutterma | 2007-06-26 12:10:33 +0200 (Di, 26 Jun 2007) | 14 lines
- changed Typelib::Element to work as attribute of a type (serialize serializes start_tag and end_tag provided by Typelib::Element around it's vontent, if present)
- worked on toClass functionality with embedded templates.
There's much to do - current impl should support:
* <element name="name" type="type"
* <element name="name"><simpleType>
* <element name="name"><complexType>
* <simpleType ...><list>
* <simpleType ...><restriction>
* <complexType ...><all>
* <complexType ...><sequence>
All other variants are not completely supported yet.
------------------------------------------------------------------------
r43 | kutterma | 2007-06-25 18:58:56 +0200 (Mo, 25 Jun 2007) | 1 line
- broke element again...
------------------------------------------------------------------------
r42 | kutterma | 2007-06-25 17:30:34 +0200 (Mo, 25 Jun 2007) | 3 lines
- fixed to_typemap to report atomic simple and complex types correctly
- update tests
- renamed WSDLFilter to WSDLHandler
------------------------------------------------------------------------
r41 | kutterma | 2007-06-25 17:29:41 +0200 (Mo, 25 Jun 2007) | 1 line
------------------------------------------------------------------------
r40 | kutterma | 2007-06-25 14:15:40 +0200 (Mo, 25 Jun 2007) | 2 lines
- Client.pm now uses XML::LibXML as default and falls back on XML::SAX::ParserFactory if not present
- fixed tests
------------------------------------------------------------------------
r39 | kutterma | 2007-06-25 14:07:28 +0200 (Mo, 25 Jun 2007) | 2 lines
- typo in Element
- fixed tests
------------------------------------------------------------------------
r38 | kutterma | 2007-06-25 10:31:20 +0200 (Mo, 25 Jun 2007) | 2 lines
- made WSDLFilter.pm a inside out class and let it run without XML::SAX::Base (This probably breaks a lot of tests - we need to implement XML::LibXML semantics in all tests / classes which use it)
- first swag at to_typemap Typemap generation. to_typemap implemented throughout the WSDL:: modules. Some implementations (Elenenet.pm, ComplexType.pm) need further work for correctly handling atomic simpleType / complexType definitions.
------------------------------------------------------------------------
r37 | kutterma | 2007-06-24 09:15:22 +0200 (So, 24 Jun 2007) | 3 lines
- added test for on-the-fly created ComplexType
- fixed ComplexType factory to really work
- startet working on Element facets
------------------------------------------------------------------------
r36 | kutterma | 2007-06-24 09:14:46 +0200 (So, 24 Jun 2007) | 2 lines
- added test for on-the-fly created ComplexType
- startet working on Element facets
------------------------------------------------------------------------
r35 | kutterma | 2007-06-24 08:13:32 +0200 (So, 24 Jun 2007) | 1 line
- implemented ComplexType as class factory to get rid of the annoying START every subclass had to implement.
------------------------------------------------------------------------
r34 | kutterma | 2007-06-23 23:22:35 +0200 (Sa, 23 Jun 2007) | 2 lines
- added XSD Typelib SimpleType, Element and ComplexType base classes (stereotypes).
ComplexType's not yet complete (no restriction / extension etc. handling).
------------------------------------------------------------------------
r33 | kutterma | 2007-06-23 11:04:56 +0200 (Sa, 23 Jun 2007) | 2 lines
- added SOAP::WSDL::XSD::Typelib::Builtin implementation of builtin XML Schema datatypes with built-in stringification, boolification and numerification.
- SAX::MessageHandler now deserializes simple types in SOAP messages into SOAP::WSDL::XSD::Typelib::Builtin (provided these are named in the ClassResolver...)
------------------------------------------------------------------------
r32 | kutterma | 2007-06-23 02:14:16 +0200 (Sa, 23 Jun 2007) | 4 lines
- added pod
- added ref handling for elements
- added abstract handling for elements (easy...)
- added storing of content model (simpleContent/complexContent) to simpleType and complexType, though the attribute is still ignored in serializing
------------------------------------------------------------------------
r31 | kutterma | 2007-06-23 00:37:18 +0200 (Sa, 23 Jun 2007) | 1 line
- renamed MessageFilter to MessageHandler
------------------------------------------------------------------------
r30 | kutterma | 2007-06-23 00:35:54 +0200 (Sa, 23 Jun 2007) | 1 line
- renamed MessageFilter to MessageHandler
------------------------------------------------------------------------
r29 | kutterma | 2007-06-23 00:35:16 +0200 (Sa, 23 Jun 2007) | 2 lines
- switched to Class::Std::Storable
- renamed MessageFilter to MessageHandler
------------------------------------------------------------------------
r28 | kutterma | 2007-06-22 18:56:28 +0200 (Fr, 22 Jun 2007) | 3 lines
- optimised SOAP::WSDL::SAX::MessageFilter for performance
- moved Typelob into own directory and load it dynamically from test script
- added some pod
------------------------------------------------------------------------
r27 | kutterma | 2007-06-22 15:34:28 +0200 (Fr, 22 Jun 2007) | 5 lines
- modified SOAP::WSDL::XSD lib to allow serializing of object hierarchies
- added SOAP::WSDL::SAX::MessageFilter for creating object hierarchies from SOAP messages
- moved Builtin XML Schema types to SOAP::WSDL:XSD::Schema::Builtin
- added test + benchmark for serializing /deserializing SOAP messages into object trees
- fixed Client to use SOAP::WSDL::Types as typelib, not first SOAP::WSDL::XSD::Schema
------------------------------------------------------------------------
r26 | kutterma | 2007-06-21 23:35:30 +0200 (Do, 21 Jun 2007) | 2 lines
- first swag at a typed SOAP Message parser.
Typelib is still to be implemented...
------------------------------------------------------------------------
r25 | kutterma | 2007-06-21 18:14:49 +0200 (Do, 21 Jun 2007) | 1 line
- added missing files from last commit
------------------------------------------------------------------------
r24 | kutterma | 2007-06-19 00:29:36 +0200 (Di, 19 Jun 2007) | 3 lines
- worked a bit on explain
- introduced handling of multiple schema definitions in one WSDL file
- fixed propagating targetNamespace to child elements in WSDLFilter
------------------------------------------------------------------------
r23 | kutterma | 2007-06-16 14:48:30 +0200 (Sa, 16 Jun 2007) | 1 line
- updated new SOAP::WSDL framework to use inside out classes based on Class::Std (not yet complete)
------------------------------------------------------------------------
r22 | kutterma | 2007-06-12 23:19:41 +0200 (Di, 12 Jun 2007) | 4 lines
- updated a few tests
- fixed a few WSDLs
- fixed handling of elements with minOccurs 0
- fixed setting of minOccurs/maxOccurs for all/sequence complexTypes
------------------------------------------------------------------------
r21 | kutterma | 2007-06-08 21:38:41 +0200 (Fr, 08 Jun 2007) | 2 lines
- updated a few tests
- fixed namespaces in tests
------------------------------------------------------------------------
r19 | kutterma | 2007-05-31 16:58:18 +0200 (Do, 31 Mai 2007) | 10 lines
- first swag at a WSDL-generated Object-tree based SOAP client.
Works as following:
a) a sax filter transforms the sax stream from a wsdl into a perl object tree
b) the perl object tree has methods for performing the following tasks:
a) explain: Tell what services and methods are there, and how to use them
b) serialize: Serialize data structures to the XML defined in the WSDL & schema
c) The client uses the generated XML to call the SOAP Server. Unfortunately, SOAP::Lite
does not allow custom XML to be rendered as a method's "value", so we have to replace
call() completely and generate the envelope on our own (which is not complete yet).
------------------------------------------------------------------------
r9 | kutterma | 2007-05-28 17:08:41 +0200 (Mo, 28 Mai 2007) | 1 line
- first try at bindings support - see t/12/bindings on how we could find out bindings and portname from a target URL
------------------------------------------------------------------------
r4 | kutterma | 2007-05-28 15:15:03 +0200 (Mo, 28 Mai 2007) | 1 line
- move from private repository to sourceforge
------------------------------------------------------------------------

View File

@@ -185,3 +185,4 @@ t/SOAP/WSDL/XSD/Typelib/Builtin/002_dateTime.t
t/SOAP/WSDL/XSD/Typelib/Builtin/002_time.t
t/SOAP/WSDL/XSD/Typelib/Builtin/003_date.t
TODO
Makefile.PL

View File

@@ -1,6 +1,6 @@
---
name: SOAP-WSDL
version: 2.00_08
version: 2.00_09
author:
abstract: SOAP with WSDL support
license: artistic
@@ -24,7 +24,7 @@ meta-spec:
provides:
SOAP::WSDL:
file: lib/SOAP/WSDL.pm
version: 2.00_08
version: 2.00_09
SOAP::WSDL::Base:
file: lib/SOAP/WSDL/Base.pm
SOAP::WSDL::Binding:

27
Makefile.PL Normal file
View File

@@ -0,0 +1,27 @@
# Note: this file was auto-generated by Module::Build::Compat version 0.03
use ExtUtils::MakeMaker;
WriteMakefile
(
'PL_FILES' => {},
'INSTALLDIRS' => 'site',
'NAME' => 'SOAP::WSDL',
'EXE_FILES' => [
bin/wsdl2perl.pl'
],
'VERSION_FROM' => 'lib/SOAP/WSDL.pm',
'PREREQ_PM' => {
'XML::SAX::ParserFactory' => 0,
'XML::Parser::Expat' => 0,
'Class::Std' => 'v0.0.8',
'Date::Format' => 0,
'Date::Parse' => 0,
'List::Util' => 0,
'LWP::UserAgent' => 0,
'XML::SAX::Base' => 0,
'XML::LibXML' => 0,
'File::Path' => 0,
'Class::Std::Storable' => 0,
'File::Basename' => 0
}
)
;

26
README
View File

@@ -1,2 +1,26 @@
INTRO
-----
SOAP-WSDL provides a SOAP client with WSDL support.
This is a developer release - everything may (and most things will) change.
INSTALLING
----------
Use the following mantra:
perl Build.PL
perl Build
perl Build test
perl Build install
If you don't have Module::Build installed, you may also use
perl Makefile.PL
make
make test
make install
Note that Module::Build is the recommended installer - make will not run
all tests provided with SOAP-WSDL.

View File

@@ -11,23 +11,37 @@
use lib 'lib/';
use MyInterfaces::FullerData_x0020_Fortune_x0020_Cookie;
use MyElements::GetFortuneCookie;
my $cookieService = MyInterfaces::FullerData_x0020_Fortune_x0020_Cookie->new();
my $cookie = $cookieService->GetFortuneCookie();
my $cookie;
$cookie = $cookieService->GetFortuneCookie()
or die "$cookie";
if ($cookie) {
print $cookie->get_GetFortuneCookieResult()->get_value, "\n";
}
else {
print $cookie;
}
print $cookie; # ->get_GetFortuneCookieResult()->get_value, "\n";
$cookie = $cookieService->GetSpecificCookie({ index => 23 });
if ($cookie) {
print $cookie
->get_GetSpecificCookieResult(), "\n";
}
else {
print $cookie;
}
$cookie = $cookieService->GetSpecificCookie({ index => 23 })
or die "$cookie";
print $cookie->get_GetSpecificCookieResult(), "\n";
print $cookie;
=for demo:
# the same in SOAP lite (second call)
#
use SOAP::Lite;
my $lite = SOAP::Lite->new()->on_action(sub { join '/', @_ } )
->proxy('http://www.fullerdata.com/FortuneCookie/FortuneCookie.asmx');
$lite->call(
SOAP::Data->name('GetSpecificCookie')
->attr({ 'xmlns', 'http://www.fullerdata.com/FortuneCookie/FortuneCookie.asmx' }),
SOAP::Data->name('index')->value(23)
);
die $soap->message() if ($soap->fault());
print $soap->result();

View File

@@ -26,7 +26,6 @@ __PACKAGE__->_factory(
{
GetWeatherResult => 'SOAP::WSDL::XSD::Typelib::Builtin::string',
}
);

View File

@@ -16,4 +16,4 @@ my $result = $weather->GetWeather({ CountryName => 'Germany', CityName => 'Munic
die $result->get_faultstring()->get_value() if not ($result); # boolean comparison overloaded
print $result->get_GetWeatherResult()->get_value() "\n";
print $result->get_GetWeatherResult()->get_value() , "\n";

View File

@@ -22,4 +22,4 @@ my $som = $soap->wsdl("file:///$path/wsdl/globalweather.xml")
die $som->message() if $som->fault();
print $som->result();
print $som->result();

View File

@@ -12,7 +12,7 @@ use XML::LibXML;
use Data::Dumper;
use LWP::UserAgent;
our $VERSION='2.00_08';
our $VERSION='2.00_09';
my %no_dispatch_of :ATTR(:name<no_dispatch>);
my %wsdl_of :ATTR(:name<wsdl>);
@@ -565,7 +565,7 @@ Passing in item => [1,2,3] could serialize to
<item>1 2</item><item>3</item>
<item>1</item><item>2 3</item>
Ambiguos data can be avoided by passing an objects as data.
Ambiguos data can be avoided by providing data as objects.
=item * XML Schema facets
@@ -615,7 +615,7 @@ the same terms as perl itself
=head1 AUTHOR
Martin Kutter E<lt>martin.kutter fen-net.deE<gt>
Martin Kutter E<lt>martin.kutter fen-net.deE<gt>
=cut

View File

@@ -34,10 +34,9 @@ sub __create_methods {
$_->new( $data );
} @{ $parts_of{ $method } };
$self->call( $method, @param );
return $self->SUPER::call( $method, @param );
}
}
}
1;

View File

@@ -5,27 +5,8 @@ use warnings;
use SOAP::WSDL::XSD::Typelib::Builtin;
use XML::Parser::Expat;
=pod
=head2 new
=over
=item SYNOPSIS
my $obj = ->new();
=item DESCRIPTION
Constructor.
=back
=cut
sub new {
my $class = shift;
my $args = shift;
my ($class, $args) = @_;
my $self = {
class_resolver => $args->{ class_resolver }
};
@@ -39,9 +20,9 @@ sub class_resolver {
}
sub _initialize {
my $self = shift;
my ($self, $parser) = @_;
$self->{ data } = undef;
delete $self->{ data };
my $characters;
my $current = undef;
@@ -50,7 +31,6 @@ sub _initialize {
my $path = []; # current path (without
# number)
my $skip = 0; # skip elements
my $parser = XML::Parser::Expat->new();
# use "globals" for speed
my ($_prefix, $_localname, $_element, $_method,
@@ -78,17 +58,16 @@ sub _initialize {
or die "Cannot resolve class for "
. join('/', @{ $path }) . " via $self->{ class_resolver }";
if ($_class eq '__SKIP__') {
$skip = join '/', @{ $path };
return;
}
# maybe write as "return $skip = join ... if (...)" ?
# would save a BLOCK...
return $skip = join('/', @{ $path }) if ($_class eq '__SKIP__');
push @$list, $current; # step down in tree ()remember current)
$characters = q{}; # empty characters
# Check whether we have a primitive - we implement them as classes
# TODO replace with UNIVERSAL->isa()
# We could replace this with UNIVERSAL->isa() - but it's slow...
# match is a bit faster if the string does not match, but WAY slower
# if $class matches...
@@ -155,18 +134,17 @@ sub _initialize {
}
sub parse {
$_[0]->_initialize->parse( $_[1] );
$_[0]->_initialize( XML::Parser::Expat->new() )->parse( $_[1] );
return $_[0]->{ data };
}
sub parsefile {
$_[0]->_initialize->parsefile( $_[1] );
$_[0]->_initialize( XML::Parser::Expat->new() )->parsefile( $_[1] );
return $_[0]->{ data };
}
sub get_data {
my $self = shift;
return $self->{ data };
return $_[0]->{ data };
}
1;

View File

@@ -2,148 +2,25 @@
package SOAP::WSDL::Expat::MessageStreamParser;
use strict;
use warnings;
use SOAP::WSDL::XSD::Typelib::Builtin;
use XML::Parser::Expat;
use SOAP::WSDL::Expat::MessageParser;
use base qw(SOAP::WSDL::Expat::MessageParser);
=pod
=head2 new
=over
=item SYNOPSIS
my $obj = ->new();
=item DESCRIPTION
Constructor.
=back
=cut
sub new {
my $class = shift;
my $self = {
class_resolver => shift->{ class_resolver }
};
bless $self, $class;
return $self;
}
sub class_resolver {
sub parse_start {
my $self = shift;
$self->{ class_resolver } = shift;
$self->{ parser } = $_[0]->_initialize( XML::Parser::ExpatNB->new() );
}
sub init {
my $self = shift;
my $xml = shift;
$self->{ data } = undef;
my $characters;
my $current = '__STOP__';
my $ignore = [ 'Envelope', 'Body' ];
my $list = [];
my $namespace = {};
my $path = [];
my $parser = XML::Parser::ExpatNB->new();
sub init;
*init = \&parse_start;
no strict qw(refs);
$parser->setHandlers(
Start => sub {
my ($parser, $element, %attrs) = @_;
my ($prefix, $localname) = split m{:}xms , $element;
# for non-prefixed elements
if (not $localname) {
$localname = $element;
$prefix = q{};
}
# ignore top level elements
if (@{ $ignore } && $localname eq $ignore->[0]) {
shift @{ $ignore };
return;
}
# empty characters
$characters = q{};
push @{ $path }, $localname; # step down...
push @{ $list }, $current; # remember current
# resolve class of this element
my $class = $self->{ class_resolver }->get_class( $path )
or die "Cannot resolve class for "
. join('/', @{ $path }) . " via $self->{ class_resolver }";
# Check whether we have a primitive - we implement them as classes
# TODO replace with UNIVERSAL->isa()
# match is a bit faster if the string does not match, but WAY slower
# if $class matches...
# if (not $class=~m{^SOAP::WSDL::XSD::Typelib::Builtin}xms) {
if (index $class, 'SOAP::WSDL::XSD::Typelib::Builtin', 0 < 0) {
# check wheter there is a CODE reference for $class::new.
# If not, require it - all classes required here MUST
# define new()
# This is the same as $class->can('new'), but it's way faster
*{ "$class\::new" }{ CODE }
or eval "require $class" ## no critic qw(ProhibitStringyEval)
or die $@;
}
# create object
# set current object
$current = $class->new({ %attrs });
# remember top level element
defined $self->{ data }
or ($self->{ data } = $current);
},
Char => sub {
$characters .= $_[1];
},
End => sub {
my $element = $_[1];
my ($prefix, $localname) = split m{:}xms , $element;
# for non-prefixed elements
if (not $localname) {
$localname = $element;
$prefix = q{};
}
# This one easily handles ignores for us, too...
return if not ref $list->[-1];
if ( $current
->isa('SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType') ) {
$current->set_value( $characters );
}
# set appropriate attribute in last element
# multiple values must be implemented in base class
my $method = "add_$localname";
$list->[-1]->$method( $current );
# step up in path
pop @{ $path };
# step up in object hierarchy...
$current = pop @{ $list };
}
);
return $parser;
sub parse_more {
$_[0]->{ parser }->parse_more( $_[1] );
}
sub get_data {
my $self = shift;
return $self->{ data };
sub parse_done {
$_[0]->{ parser }->parse_done();
}
1;
=pod
@@ -174,15 +51,7 @@ See L<SOAP::WSDL::Parser> for details.
=head1 Bugs and Limitations
=over
=item * Ignores all namespaces
=item * Does not handle mixed content
=item * The SOAP header is ignored
=back
See SOAP::WSDL::Expat::MessageParser
=head1 AUTHOR

View File

@@ -192,17 +192,17 @@ my %[% element.get_name %]_of :ATTR(:get<[% element.get_name %]>);
[% END %]
__PACKAGE__->_factory(
[ qw([% FOREACH element=self.get_element -%]
[% element.get_name %]
[ qw([% FOREACH element=self.get_element -%]
[% element.get_name %]
[% END %]) ],
{
[% FOREACH element=self.get_element %][% element.get_name %] => \%[% element.get_name %]_of,
[% END %]
{
[% FOREACH element=self.get_element %][% element.get_name %] => \%[% element.get_name %]_of,
[% END %]
},
{
[%-
[%-
FOREACH element=self.get_element;
IF (element.get_type);
IF (element.get_type); # element type="..."
split_name = element.get_type.split(':');
prefix = split_name.0;
localname = split_name.1;
@@ -210,8 +210,13 @@ __PACKAGE__->_factory(
[% element.get_name %] => 'SOAP::WSDL::XSD::Typelib::Builtin::[% localname %]',
[% ELSE -%]
[% element.get_name %] => '[% type_prefix %][% localname %]',
[%- END;
ELSIF (simpleType = element.first_simpleType);
[%- END;
ELSIF (element.get_ref); # element ref="..."
split_name = element.get_ref.split(':');
prefix = split_name.0;
localname = split_name.1; %]
[% element.get_name %] => '[% type_prefix %][% localname %]',
[% ELSIF (simpleType = element.first_simpleType);
base = simpleType.get_base();
%]
# basic simple type handling: we treat atomic simple types
@@ -269,7 +274,12 @@ methods:
[% ELSE -%]
[% element.get_name %] => '[% type_prefix %][% localname %]',
[%- END;
ELSIF (simpleType = element.first_simpleType);
ELSIF (element.get_ref); # element ref="..."
split_name = element.get_ref.split(':');
prefix = split_name.0;
localname = split_name.1; %]
[% element.get_name %] => '[% type_prefix %][% localname %]',
[% ELSIF (simpleType = element.first_simpleType);
base = simpleType.get_base();
split_name = base.split(':');
prefix = split_name.0;

View File

@@ -90,8 +90,8 @@ sub serialize {
elsif (my $ref_name = $ref_of{ $ident }) { # ref
my ($prefix, $localname) = split /:/ , $ref_name;
my $ns = $ns_map{ $prefix };
$type = $typelib->find_type( $ns, $localname );
die "no type for $prefix:$localname" if (not $type);
$type = $typelib->find_element( $ns, $localname );
die "no element for ref $prefix:$localname" if (not $type);
return $type->serialize( $name, $value, $opt );
}
@@ -130,6 +130,12 @@ sub explain {
}
return $type->explain( $opt, $self->get_name() );
}
elsif (my $element_name = $self->get_ref() ) {
my $element = $opt->{ wsdl }->first_types()->find_element(
$opt->{ wsdl }->_expand( $element_name )
);
return $element->explain( $opt, $self->get_name() );
}
# return if it's not a derived type - we don't handle
# other stuff yet.
@@ -152,7 +158,7 @@ sub explain {
delete $opt->{ anonymous };
return $text .= $type->explain( $opt, undef );
}
return $text .= $type->explain( $opt, $self->get_name() );
return $text .= $type->explain( $opt, $name || $self->get_name() );
return 'ERROR: '. $@;
}
@@ -240,6 +246,7 @@ package [% element_prefix %][% self.get_name %];
use strict;
use Class::Std::Storable;
use SOAP::WSDL::XSD::Typelib::Element;
[% IF (type = self.first_simpleType) %]
# <element name="[% self.get_name %]"><simpleType> definition
use SOAP::WSDL::XSD::Typelib::SimpleType;
@@ -249,6 +256,17 @@ use base qw(
[% type.flavor_class %]
[% type.base_class($type_prefix) %]
);
[% ELSIF (ref_name = self.get_ref);
split_name = ref_name.split(':');
prefix = split_name.0;
localname = split_name.1;
ref_class = element_prefix _ localname;
%]
# <element name="[% self.get_name %]" ref="[% ref_name %]"> definition
# use [% ref_class %];
use base qw(
[% ref_class %]
);
[% ELSIF (type = self.first_complexType) %]
# atomic complexType
# <element name="[% self.get_name %]"><complexType> definition
@@ -263,7 +281,7 @@ my %[% element.get_name %]_of :ATTR(:get<[% element.get_name %]>);
[% END %]
__PACKAGE__->_factory(
[ qw([% FOREACH element = type.get_element %]
[ qw([% FOREACH element = type.get_element %]
[% element.get_name %]
[% END %]) ],
{
@@ -276,10 +294,10 @@ __PACKAGE__->_factory(
prefix = split_name.0;
localname = split_name.1;
IF nsmap.$prefix == 'http://www.w3.org/2001/XMLSchema' %]
[% element.get_name %] => 'SOAP::WSDL::XSD::Typelib::Builtin::[% localname %]',
[% element.get_name %] => 'SOAP::WSDL::XSD::Typelib::Builtin::[% localname %]',
[% ELSE %]
[% element.get_name %] => '[% type_prefix %][% localname %]',
[% END %]
[% END %]
[% END %]
}
);
@@ -304,10 +322,6 @@ use base qw(
SOAP::WSDL::XSD::Typelib::Element
[% base_class %]
);
[% ELSIF (element = self.get_ref)
%]
# element ref"element" definition
# Sorry, we don't handle this yet...
[% END %]
sub get_xmlns { '[% self.get_targetNamespace %]' }

View File

@@ -7,6 +7,7 @@ use base qw(SOAP::WSDL::Base);
# child elements
my %type_of :ATTR(:name<type> :default<[]>);
my %element_of :ATTR(:name<element> :default<[]>);
my %group_of :ATTR(:name<group> :default<[]>);
# attributes
my %attributeFormDefault_of :ATTR(:name<attributeFormDefault> :default<()>);

View File

@@ -29,6 +29,13 @@ sub as_bool :BOOLIFY {
return $value_of { ident $_[0] };
}
sub _get_handlers {
my $parser = $_[1];
return {
Char => $parser->characters(),
}
}
Class::Std::initialize(); # make :BOOLIFY overloading serializable

View File

@@ -40,7 +40,7 @@ sub serialize {
, $self->end_tag($opt);
}
sub as_num :NUMERIFY {
sub as_num :NUMERIFY :BOOLIFY {
return $_[0]->get_value();
}

View File

@@ -36,10 +36,10 @@ BEGIN {
sub set_value {
# use set_value from base class if we have a XML-DateTime format
#2037-12-31T00:00:00.0000000+01:00
#2037-12-31+01:00
if (
$_[1] =~ m{ ^\d{4} \- \d{2} \- \d{2}
(:? [\+\-] \d{2} \: \d{2} )?
(:? [\+\-] \d{2} \: \d{2} )?$
}xms
) {
$_[0]->SUPER::set_value($_[1])

View File

@@ -46,16 +46,19 @@ sub set_value {
$_[0]->SUPER::set_value($_[1])
}
# use a combination of strptime and strftime for converting the date
# strptime does not emit timezone info, so we're pretty fucked up here.
#
# Unfortunately, strftime outputs the time zone as [+-]0000, whereas XML
# whants it as [+-]00:00
# We leave out the optional nanoseconds part, as it would always be empty.
else {
# strptime sets empty values to undef - and strftime doesn't like that...
my @time_from = map { ! defined $_ ? 0 : $_ } strptime($_[1]);
my @time_from = map { ! defined $_ ? 0 : $_ } strptime($_[1]);
undef $time_from[-1];
my $time_str = strftime( '%Y-%m-%dT%H:%M:%S%z', @time_from );
substr $time_str, -2, 0, ':';
$_[0]->SUPER::set_value($time_str);
}
}

View File

@@ -22,26 +22,3 @@ BEGIN {
};
}
1;
__END__
=pod
=head1 NAME
SOAP::WSDL::XSD::Typelib::Builtin::unsignedLong - unsigned long integer objects
=head1 DESCRIPTION
Subclass of nonNegativeInteger.
=head1 LICENSE
This file is part of SOAP-WSDL. You may distribute/modify it under
the same terms as perl itself
=head1 AUTHOR
Martin Kutter E<lt>martin.kutter fen-net.deE<gt>
=cut

View File

@@ -40,15 +40,13 @@ sub _factory {
*{ "$class\::set_$name" } = sub {
my ($self, $value) = @_;
=pod
=for developers
The structure below looks rather weird, but is optimized for performance.
We could use sub calls for sure, but these are much slower. And the logic
is not that easy:
we accept:
a) objects
b) scalars
@@ -92,7 +90,7 @@ is not that easy:
? $type->new( $value )
: $is_ref eq $type
? $value
: die 'Cannot use non-ARRAY/HASH as data'
: die croak "cannot use $is_ref reference as value for $name - $type required"
: $type->new({ value => $value });
};
@@ -114,70 +112,69 @@ is not that easy:
return push @{ $attribute_ref->{ $ident } }, $value;
};
*{ "$class\::START" } = sub {
my ($self, $ident, $args_of) = @_;
# iterate over keys of arguments
# and call set appropriate field in clase
map { ($ATTRIBUTES_OF{ $class }->{ $_ })
? do {
my $method = "set_$_";
$self->$method( $args_of->{ $_ } );
}
: $_ =~ m{ \A # beginning of string
xmlns # xmlns
}xms
? do {}
: do { use Data::Dumper;
croak "unknown field $_ in $class. Valid fields are "
. join(', ', @{ $ELEMENTS_FROM{ $class } }) . "\n"
. Dumper @_ };
# TODO maybe only warn for unknown fields ?
} keys %$args_of;
};
# this serialize method works fine for <all> and <sequence>
# complextypes, as well as for <restriction><all> or
# <restriction><sequence>.
# But what about choice, group, extension ?
#
}
*{ "$class\::START" } = sub {
my ($self, $ident, $args_of) = @_;
# iterate over keys of arguments
# and call set appropriate field in clase
map { ($ATTRIBUTES_OF{ $class }->{ $_ })
? do {
my $method = "set_$_";
$self->$method( $args_of->{ $_ } );
}
: $_ =~ m{ \A # beginning of string
xmlns # xmlns
}xms
? do {}
: do { use Data::Dumper;
croak "unknown field $_ in $class. Valid fields are:\n"
. join(', ', @{ $ELEMENTS_FROM{ $class } }) . "\n"
. "Structure given:\n" . Dumper @_ };
} keys %$args_of;
return $self;
};
# this serialize method works fine for <all> and <sequence>
# complextypes, as well as for <restriction><all> or
# <restriction><sequence>.
# But what about choice, group, extension ?
*{ "$class\::_serialize" } = sub {
my $ident = ident $_[0];
# my $class = ref $_[0];
# return concatenated return value of serialize call of all
# elements retrieved from get_elements expanding list refs.
# get_elements is inlined for performance.
return join q{} , map {
my $element = $ATTRIBUTES_OF{ $class }->{ $_ }->{ $ident };
if (defined $element) {
$element = [ $element ]
if not ref $element eq 'ARRAY';
my $name = $_;
my $ident = ident $_[0];
# my $class = ref $_[0];
# return concatenated return value of serialize call of all
# elements retrieved from get_elements expanding list refs.
# get_elements is inlined for performance.
return join q{} , map {
my $element = $ATTRIBUTES_OF{ $class }->{ $_ }->{ $ident };
# do we have some content
if (defined $element) {
$element = [ $element ]
if not ref $element eq 'ARRAY';
my $name = $_;
map {
# serialize element elements with their own serializer
# but name them like they're named here.
if ( $_->isa( 'SOAP::WSDL::XSD::Typelib::Element' ) ) {
$_->serialize( { name => $name } );
}
# serialize complextype elments (of other types) with their
# serializer, but add element tags around.
else {
join q{}, $_->start_tag({ name => $name })
, $_->serialize()
, $_->end_tag({ name => $name });
}
} @{ $element }
}
else {
q{};
}
} (@{ $ELEMENTS_FROM{ $class } });
};
map {
# serialize element elements with their own serializer
# but name them like they're named here.
if ( $_->isa( 'SOAP::WSDL::XSD::Typelib::Element' ) ) {
$_->serialize( { name => $name } );
}
# serialize complextype elments (of other types) with their
# serializer, but add element tags around.
else {
join q{}, $_->start_tag({ name => $name })
, $_->serialize()
, $_->end_tag({ name => $name });
}
} @{ $element }
}
else {
q{};
}
} (@{ $ELEMENTS_FROM{ $class } });
};
*{ "$class\::serialize" } = sub {
my ($self, $opt) = @_;
@@ -191,7 +188,7 @@ is not that easy:
}
}
1;
__END__
@@ -202,6 +199,81 @@ __END__
SOAP::WSDL::XSD::Typelib::ComplexType - complexType base class
=head1 Subclassing
package MyComplexType;
use Class::Std::Storable
use base qw(SOAP::WSDL::XSD::Typelib::ComplexType);
__PACKAGE__->_factory(
\@elements_from,
\%attributes_of,
\%classes_of
);
When subclassing, the following methods are created in the subclass:
=head2 new
Constructor. For your convenience, new will accept data for the object's
properties in the following forms:
hash refs
1) of scalars
2) of list refs
3) of hash refs
4) of objects
5) mixed stuff of all of the above
new() will set the data via the set_FOO methods to the object's element
properties.
Data passed to new must comply to the object's structure or new() will
complain. Objects passed must be of the expected type, or new() will
complain, too.
Examples:
my $obj = MyClass->new({ MyName => $value });
my $obj = MyClass->new({
MyName => {
DeepName => $value
},
MySecondName => $value,
});
my $obj = MyClass->new({
MyName => [
{ DeepName => $value },
{ DeepName => $other_value },
],
MySecondName => $object,
MyThirdName => [ $object1, $object2 ],
});
To be correct, SOAP::WSDL::XSD::Typelib::ComplexType will create a START
method, not new() - but new() will be created from Class::Std::Storable and
behave like stated above.
=head2 set_FOO
A mutator method for every element property.
For your convenience, the set_FOO methods will accept all kind of data you
can think of (and all combinations of them) as input - with the exception
of GLOBS and filehandles.
This means you may set element properties by passing
a) objects
b) scalars
c) list refs
d) hash refs
e) mixed stuff of all of the above
Examples are similar to the examples provided for new() above.
=head1 Bugs and limitations
=over

View File

@@ -56,7 +56,8 @@ for my $element (@{ $wsdl->first_types()->get_schema()->[1]->get_type() } ) {
next;
}
my $name = 'MessageGateway::' . $element->get_name();
ok eval $output, $name;
ok eval $output, $name
or die $@, $output;
ok $name->can('serialize'), "$name\->can('serialize')";
}

View File

@@ -1,4 +1,4 @@
use Test::More tests => 6;
use Test::More tests => 8;
use strict;
use warnings;
use lib '../lib';
@@ -39,6 +39,16 @@ ok ($xml = $soap->call('test',
testElement1 => 'Test'
), 'Serialized (simple) element' );
ok ($xml = $soap->call('testRef',
testElementRef => 'Test'
), 'Serialized (simple) element' );
is $xml
, q{<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" ><SOAP-ENV:Body><testElementRef xmlns="urn:Test">Test</testElementRef>
</SOAP-ENV:Body></SOAP-ENV:Envelope>}
, 'element ref serialization result'
;
TODO: {
local $TODO="implement min/maxOccurs checks";

View File

@@ -1,21 +1,34 @@
use Test::More tests => 2;
use Test::More tests => 4;
use strict;
use warnings;
use lib '../lib';
use Date::Parse;
use Date::Format;
sub timezone {
my @time = strptime shift;
my $tz = strftime('%z', @time);
substr $tz, -2, 0, ':';
return $tz;
}
use_ok('SOAP::WSDL::XSD::Typelib::Builtin::dateTime');
my $obj;
my %dates = (
'2007-12-31 12:32' => '2007-12-31T12:32:00',
'2007-08-31 00:32' => '2007-08-31T00:32:00',
'30 Aug 2007' => '2007-08-30T00:00:00',
);
$obj = SOAP::WSDL::XSD::Typelib::Builtin::dateTime->new();
while (my ($date, $converted) = each %dates ) {
$obj->set_value( '2037-12-31' );
$obj = SOAP::WSDL::XSD::Typelib::Builtin::dateTime->new();
$obj->set_value( $date );
is $obj->get_value() , $converted . timezone($date), 'conversion';
}
$obj->set_value('2007-12-31T00:00:00.0000000+01:00');
is $obj->get_value() , '2037-12-31T00:00:00+01:00', 'conversion';
$obj->set_value('2037-12-31T00:00:00.0000000+01:00');
# exit;
#~ use Benchmark;

View File

@@ -1,17 +1,35 @@
use Test::More tests => 3;
use Test::More tests => 6;
use strict;
use warnings;
use lib '../lib';
use Date::Format;
use Date::Parse;
use_ok('SOAP::WSDL::XSD::Typelib::Builtin::date');
my $obj;
$obj = SOAP::WSDL::XSD::Typelib::Builtin::date->new();
sub timezone {
my @time = strptime shift;
my $tz = strftime('%z', @time);
substr $tz, -2, 0, ':';
return $tz;
}
$obj->set_value( '2037/12/31' );
is $obj->get_value() , '2037-12-31+01:00', 'conversion';
my %dates = (
'2007/12/31' => '2007-12-31',
'2007:08:31' => '2007-08-31',
'30 Aug 2007' => '2007-08-30',
);
while (my ($date, $converted) = each %dates ) {
$obj = SOAP::WSDL::XSD::Typelib::Builtin::date->new();
$obj->set_value( $date );
is $obj->get_value() , $converted . timezone($date), 'conversion';
}
$obj->set_value('2007-12-31T00:00:00.0000000+01:00');
is $obj->get_value() , '2007-12-31+01:00', 'conversion from XML dateTime';
$obj->set_value( '2037-12-31' );
is $obj->get_value() , '2037-12-31', 'no conversion on match';

View File

@@ -1,72 +1,63 @@
<?xml version="1.0"?>
<definitions name="urn:Test"
targetNamespace="urn:Test"
xmlns:tns="urn:Test"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>
<definitions name="urn:Test" targetNamespace="urn:Test" xmlns:tns="urn:Test"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<types>
<xsd:schema targetNamespace="urn:Test">
<xsd:complexType name="testComplexTypeAll">
<xsd:annotation>
<xsd:documentation>
ComplexType Test
</xsd:documentation>
</xsd:annotation>
<xsd:annotation>
<xsd:documentation>ComplexType Test</xsd:documentation>
</xsd:annotation>
<xsd:all>
<xsd:element name="Test1" type="xsd:string"/>
<xsd:element name="Test2" type="xsd:string" minOccurs="1"/>
</xsd:all>
<xsd:element name="Test1" type="xsd:string" />
<xsd:element name="Test2" type="xsd:string" minOccurs="1" />
</xsd:all>
</xsd:complexType>
<xsd:complexType name="testComplexTypeSequence">
<xsd:annotation>
<xsd:documentation>
ComplexType Test
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="Test1" type="xsd:string" minOccurs="1"/>
<xsd:element name="Test2" type="xsd:string" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="testComplexTypeSequence">
<xsd:annotation>
<xsd:documentation>ComplexType Test</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="Test1" type="xsd:string" minOccurs="1" />
<xsd:element name="Test2" type="xsd:string" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</types>
<message name="testRequest">
<part name="testAll" type="tns:testComplexTypeAll"/>
</message>
<message name="testResponse">
<part name="testAll" type="tns:testComplexTypeAll"/>
</message>
<portType name="testPort">
<operation name="test">
<documentation>
Test-Methode
</documentation>
</types>
<message name="testRequest">
<part name="testAll" type="tns:testComplexTypeAll" />
</message>
<message name="testResponse">
<part name="testAll" type="tns:testComplexTypeAll" />
</message>
<portType name="testPort">
<operation name="test">
<documentation>Test-Methode</documentation>
<input message="tns:testRequest"/>
<output message="tns:testResponse"/>
</operation>
</portType>
<input message="tns:testRequest" />
<output message="tns:testResponse" />
</operation>
</portType>
<binding type="tns:testPort" name="testBinding">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="test">
<soap:operation soapAction="test">
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</soap:operation>
</operation>
</binding>
<service name="testService">
<port name="testPort" binding="tns:testBinding">
<soap:address location="http://127.0.0.1/testPort" />
</port>
</service>
</definitions>
<binding type="tns:testPort" name="testBinding">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="test">
<soap:operation soapAction="test">
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</soap:operation>
</operation>
</binding>
<service name="testService">
<port name="testPort" binding="tns:testBinding">
<soap:address location="http://127.0.0.1/testPort" />
</port>
</service>
</definitions>

View File

@@ -9,12 +9,17 @@
<types>
<xsd:schema targetNamespace="urn:Test">
<xsd:element name="testElement1" type="xsd:string" />
<xsd:element name="testElement2" type="xsd:int" />
<xsd:element name="testElement2" type="xsd:int" />
<xsd:element name="testElementRef" ref="tns:testElement1" />
</xsd:schema>
</types>
<message name="testRequest">
<part name="testAll" element="tns:testElement1"/>
</message>
<message name="testRefRequest">
<part name="testAll" element="tns:testElementRef"/>
</message>
<message name="testResponse">
<part name="testAll" type="tns:testElement1"/>
</message>
@@ -27,10 +32,18 @@
<input message="tns:testRequest"/>
<output message="tns:testResponse"/>
</operation>
<operation name="testRef">
<documentation>
Test-Methode
</documentation>
<input message="tns:testRefRequest"/>
<output message="tns:testResponse"/>
</operation>
</portType>
<binding type="tns:testPort" name="testBinding">
<operation name="test">
<operation name="test">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<soap:operation soapAction="test">
<input>
@@ -40,7 +53,18 @@
<soap:body use="literal"/>
</output>
</soap:operation>
</operation>
</operation>
<operation name="testRef">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<soap:operation soapAction="testRef">
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</soap:operation>
</operation>
</binding>
<service name="testService">
<port name="testPort" binding="tns:testBinding">