SOAP::...nsport(3pm)

πŸ‘‘ SOAP::WSDL::Factory::Transport πŸ’…

Hiii bestie, welcome to the manual page for SOAP::WSDL::Factory::Transport β€” it ships with User Contributed Perl Documentation and it's literally the factory that hands you transport objects. Let's get into it, no cap. ✨


🌸 NAME

SOAP::WSDL::Factory::Transport β€” the Factory for retrieving transport objects. That's the whole job. She's a factory. She makes transports. Periodt. πŸŽ€


✨ SYNOPSIS

Here's the vibe in code, verbatim, don't touch anything:

# from SOAP::WSDL::Client:
$transport = SOAP::WSDL::Factory::Transport->get_transport( $url, @opt );

# in transport class:
package MyWickedTransport;
use SOAP::WSDL::Factory::Transport;

# register class as transport module for httpr and https
# (httpr is "reliable http", a protocol developed by IBM).
SOAP::WSDL::Factory::Transport->register( 'httpr' , __PACKAGE__ );
SOAP::WSDL::Factory::Transport->register( 'https' , __PACKAGE__ );

Yes, httpr is real β€” it's "reliable http", a protocol IBM came up with. Not me making things up. πŸ’–


πŸ¦‹ DESCRIPTION

So SOAP::WSDL::Transport is the factory that fetches transport objects for SOAP::WSDL. That's her whole personality.

The actual work? Done by the specific transport classes. She's just the matchmaker, the classes do the dating. 😌

Here's the tea on how SOAP::WSDL::Transport picks a class to load β€” she tries these in order:

  • the class you registered for the scheme via register() πŸ‘‘
  • the SOAP::Lite class that matches the scheme
  • the SOAP::WSDL class that matches the scheme

πŸ’… METHODS

🌈 register

SOAP::WSDL::Transport->register('https', 'MyWickedTransport');

Globally registers a class so it can be used as a transport class. Global. Everyone sees it. She said "I'm taken". πŸ’€

πŸ“ proxy

$trans->proxy('http://soap-wsdl.sourceforge.net');

Sets the proxy β€” aka the endpoint.

And it returns the transport for this protocol. Giving both, because she can. 🫢

🧚 set_transport

Sets the current transport object.

⭐ get_transport

Gets the current transport object.


🌈 WRITING YOUR OWN TRANSPORT CLASS

πŸŽ€ Registering a transport class

Transport classes must be registered with SOAP::WSDL::Factory::Transport. Non-negotiable, bestie.

You do it by running this code, where $scheme is the URL scheme the class should be used for, and $module is the class' module name:

SOAP::WSDL::Factory::Transport->register( $scheme, $module);

Wanna auto-register your transport class the moment it loads? Just run register() inside your transport class β€” see the SYNOPSIS above, it's all there. ✨

And yeah, you can register multiple protocols or multiple classes β€” just call register() multiple times. Stack 'em. πŸ”₯

πŸ’œ Transport plugin package layout

Lowkey important: you may only use transport classes whose name is either the module name, or the module name with ::Client appended. That's the rule, iykyk.

🌸 Methods to implement

Transport classes must implement the interface that SOAP::Lite transport classes require β€” check SOAP::Lite::Transport for the details, and SOAP::WSDL::Transport::HTTP for a real example. πŸ‘‘

To provide that interface, transport modules must implement these methods:

  • new
  • send_receive β€” dispatches a request and returns the content of the response.
  • code β€” returns the status code of the last send_receive call (if any).
  • message β€” returns the status message of the last send_receive call (if any).
  • status β€” returns the status of the last send_receive call (if any).
  • is_success β€” returns true after a send_receive was successful, false if it was not.

Now here's the SOAP::Lite lore: SOAP::Lite requires transport modules to pack client and server classes in one file, and to follow this naming scheme:

Module name:
  "SOAP::Transport::" . uc($scheme)

Client class (additional package in module):
  "SOAP::Transport::" . uc($scheme) . "::Client"

Server class (additional package in module):
  "SOAP::Transport::" . uc($scheme) . "::Client"

SOAP::WSDL does not require you to follow these restrictions. Freedom, bestie. πŸ•ŠοΈ

There is only one restriction in SOAP::WSDL:

You may only use transport classes whose name is either the module name or the module name with ::Client appended. (Yes, she repeats herself β€” she really means it.)

SOAP::WSDL will try to instantiate an object of your transport class with ::Client appended, so that you can use transport classes written for SOAP::Lite. Iconic of her, honestly.

⚠️ Heads up though: this may lead to errors when a different module with the name of your transport module suffixed with ::Client is also loaded. Be careful out there. πŸ’€

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. Slay, and legally so. πŸ’…


🫢 AUTHOR

Martin Kutter <martin.kutter fen-net.de> β€” the main character who wrote all of this. Respect. πŸ‘‘


πŸ—‚ REPOSITORY INFORMATION

$Rev: 851 $
$LastChangedBy: kutterma $
$Id: Transport.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/Transport.pm $

And that's the whole page, bestie!! This one was generated for perl v5.36.0, dated 2022-10-14 β€” so if you're reading it, that's the era you're in. Go register some transports and be amazing. πŸ¦‹βœ¨πŸ’– mwah.

πŸ“¦ where this page comes from