SOAP::...ializer(3pm)

πŸ’– SOAP::WSDL::Factory::Serializer πŸ’–

okay so bestie, this one lives in the User Contributed Perl Documentation section of your man pages, and it's genuinely one of those little glue modules that does so much heavy lifting behind the scenes. it's the factory that hands out serializer objects. that's it. that's the whole job. but the way it does it?? iconic.


✨ NAME ✨

SOAP::WSDL::Factory::Serializer β€” a factory for retrieving serializer objects πŸŽ€


🌸 SYNOPSIS 🌸

here's the vibe, fr fr:

# from SOAP::WSDL::Client:
$serializer = SOAP::WSDL::Factory::Serializer->get_serializer({
    soap_version => $soap_version,
});

# in serializer class:
package MyWickedSerializer;
use SOAP::WSDL::Factory::Serializer;

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

πŸ¦‹ DESCRIPTION πŸ¦‹

so SOAP::WSDL::Factory::Serializer is literally the factory for retrieving serializer objects for SOAP::WSDL. it's giving middle-management but in the best way possible β€” it doesn't do the work itself, it just hooks you up with the thing that does. πŸ’…

the actual work gets done by specific serializer classes. the factory is just the matchmaker.

and here's the thing β€” SOAP::WSDL::Serializer tries to load one of the following classes:

  • the class registered for the scheme via register()

periodt. that's the list.


✨ METHODS ✨

πŸ’œ register

SOAP::WSDL::Serializer->register('1.1', 'MyWickedSerializer');

globally registers a class for use as serializer class. like, announces it to the whole world. loud and proud. πŸ“£

πŸ’œ get_serializer

returns an object of the serializer class for this endpoint. you ask, it delivers. no cap.


🌈 WRITING YOUR OWN SERIALIZER CLASS 🌈

okay this is the part where you get to be the main character and build your own.

πŸŽ€ Registering a deserializer

serializer classes may register with SOAP::WSDL::Factory::Serializer. (yes bestie, the heading says "deserializer" and the body says "serializer" β€” we're all just going with it, it's fine, we love her. πŸ™ˆ)

serializer objects may also be passed directly to SOAP::WSDL::Client by using the set_serializer method.

⚠️ real talk warning: serializer objects set via SOAP::WSDL::Client's set_serializer method are discarded when the SOAP version is changed via set_soap_version. like, gone. poof. so don't get attached. 😭

registering a serializer class with SOAP::WSDL::Factory::Serializer 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::Serializer->register( $version, $class);

to auto-register your tranport class on loading, execute register() in your tranport class (see "SYNOPSIS" above). 🌟

πŸŽ€ Serializer package layout

serializer modules must be named equal to the serializer class they contain. there can only be one serializer class per serializer module. one class, one module, monogamy only. πŸ’

πŸŽ€ Methods to implement

serializer classes must implement the following methods:

  • new β€” constructor. the birth. the origin story. ⭐
  • serialize β€” serializes data to XML. the following named parameters are passed to the serialize method in a anonymous hash ref:
{
  method => $operation_name,
  header => $header_data,
  body => $body_data,
}

look at that little hash. so tidy. so organized. obsessed. 🫢


Copyright 2004-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: 851 $
 $LastChangedBy: kutterma $
 $Id: Serializer.pm 851 2009-05-15 22:45:18Z 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!! πŸŽ‰ this was rendered for you by perl v5.36.0, dated 2022-10-14, in the SOAP::...ializer(3pm) era β€” ancient relics but the knowledge is timeless. go forth and serialize. slay. πŸ’…βœ¨πŸŒ·

πŸ“¦ where this page comes from