SOAP::...ializer(3pm)

πŸ’– NAME πŸ’–

SOAP::WSDL::Factory::Deserializer β€” the factory bestie that hands you Deserializer objects ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

okay so here's the whole vibe, copy-paste ready, no cap:

# from SOAP::WSDL::Client:
$deserializer = SOAP::WSDL::Factory::Deserializer->get_deserializer({
    soap_version => $soap_version,
    class_resolver => $class_resolver,
});

# in deserializer class:
package MyWickedDeserializer;
use SOAP::WSDL::Factory::Deserializer;

# register class as deserializer for SOAP1.2 messages
SOAP::WSDL::Factory::Deserializer->register( '1.2' , __PACKAGE__ );

🌈 DESCRIPTION 🌈

SOAP::WSDL::Factory::Deserializer is literally the factory that goes and fetches deserializer objects for SOAP::WSDL. It's giving matchmaker energy β€” it doesn't do the work itself, it just finds you the right one πŸ’…

The actual work? That's done by the specific deserializer classes. They're the main characters, this one's the manager.

SOAP::WSDL::Deserializer tries to load one of these:

  • The class registered for the scheme via register()

And by default? SOAP::WSDL::Deserializer::XSD is registered for SOAP1.1 messages. That's the preset, the default fit, the one that's already in your closet πŸŽ€


⭐ METHODS ⭐

🌸 register 🌸

SOAP::WSDL::Deserializer->register('1.1', 'MyWickedDeserializer');

Globally registers a class for use as deserializer class. Like, for real globally β€” everybody, everywhere, all at once πŸ‘‘

🌸 get_deserializer 🌸

Returns an object of the deserializer class for this endpoint. That's it, that's the whole job 🫢


🧚 WRITING YOUR OWN DESERIALIZER CLASS 🧚

Deserializer classes may register with SOAP::WSDL::Factory::Deserializer. Yes queen, build your own, I believe in you πŸ’œ

✨ Registering a deserializer ✨

Registering a deserializer class with SOAP::WSDL::Factory::Deserializer is done by executing the following code where $version is the SOAP version the class should be used for, and $class is the class name.

SOAP::WSDL::Factory::Deserializer->register( $version, $class);

To auto-register your transport class on loading, execute register() in your transport class (peep the SYNOPSIS up above πŸ‘€).

πŸŽ€ Deserializer package layout πŸŽ€

Deserializer modules must be named equal to the deserializer class they contain. And listen β€” there can only be one deserializer class per deserializer module. One. Mono. Solitary. It's giving exclusive πŸ’€

πŸ“ Methods to implement πŸ“

Deserializer classes must implement the following methods:

  • new β€” Constructor. The birth of the object, the origin story ✨
  • deserialize β€” Deserialize data from XML to arbitrary formats.

deserialize() must return a fault indicating that deserializing failed if any error is encountered during the process of deserializing the XML message. So if it goes wrong, say it went wrong β€” don't ghost the caller 😭

The following positional parameters are passed to the deserialize method:

$content   - the xml message
  • generate_fault β€” Generate a fault in the supported format. The following named parameters are passed as a single hash ref:
code       - The fault code, e.g. 'soap:Server' or the like
role       - The fault role (actor in SOAP1.1)
message    - The fault message (faultstring in SOAP1.1)

Copyright 2007 Martin Kutter. All rights reserved.

This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself


πŸ’œ AUTHOR πŸ’œ

Martin Kutter <martin.kutter fen-net.de>


🌟 REPOSITORY INFORMATION 🌟

 $Rev: 176 $
 $LastChangedBy: kutterma $
 $Id: Serializer.pm 176 2007-08-31 15:28:29Z kutterma $
 $HeadURL: https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Factory/Serializer.pm $

and that's the whole page bestie, you ate it πŸ’…βœ¨

perl v5.36.0 Β· 2022-10-14 Β· SOAP::...ializer(3pm) β€” mwah, go forth and deserialize, ily πŸ«ΆπŸŽ€

πŸ“¦ where this page comes from