Yenya's World

Wed, 28 Nov 2012


Today's daily WTF goes to the SOAP::Lite CPAN package and its non-configurability and mis-design.

For example, look at this:

HTTP Basic authentication is accomplished by overriding the get_basic_credentials suboutine in LWP::UserAgent (which SOAP::Transport::HTTP::Client is a subclass):
    sub SOAP::Transport::HTTP::Client::get_basic_credentials {
      return 'username' => 'password';

So apparently the only way how to use Basic authentication is to override a global function in some foreign namespace. And what to do when I want to use two SOAP servers with two sets of credentials inside a single application? There are more similar "features" in SOAP::Lite. For example, tracing can only be set up globally in compile-time, or by manually calling ->import().

My dear lazyweb, is there a SOAP module with cleaner design?

UPDATE 2012/11/28: Tracing
FWIW, it is probably easier and cleaner to do both basic authentication and tracing at the transport level - the transport module here is LWP::UserAgent (thanks Adelton for the hint!), so for example handlers described in the LWP::UserAgent manpage work:

	request_prepare => sub {
		shift->authorization_basic($login, $pass);

	request_send => sub { print STDERR shift->content; },
	response_done => sub { print STDERR shift->content; },

I wonder why the SOAP::Lite manpages suggest such dirty ways of handling this (and I have not even started mentioning things like $SOAP::Transport::HTTP::Client::USERAGENT_CLASS global variable; ugh)

Section: /computers (RSS feed) | Permanent link | 3 writebacks

3 replies for this story:

Adelton wrote:

From man page: Because "SOAP::Client" inherits from "LWP::UserAgent", you can use any of "LWP::UserAgent"'s proxy settings. Can't you really apply the same to the ->credentials call? Eg, $soap->transport->credentials($netloc, $realm, $uname, $pass); ?

Adelton wrote:

By the way, who is holding a gun to your head to force you to use SOAP?

Yenya wrote: Re: Adelton

Well, why TF they have "redefine the get_basic_credential" in the POD as their prefered way of handling basic auth then? (ISDS is the gun holder there, but fortunately this is not my job, I just tried to help one of my colleagues :-)

Reply to this story:

URL/Email: [http://... or mailto:you@wherever] (optional)
Title: (optional)
Key image: key image (valid for an hour only)
Key value: (to verify you are not a bot)


Yenya's World: Linux and beyond - Yenya's blog.


RSS feed

Jan "Yenya" Kasprzak

The main page of this blog



Blog roll:

alphabetically :-)