mrguy123 has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks,
I've been working a bit lately with the SOAP::Lite module, and would like to add Web Proxy settings in some of the cases. When I connect to SOAP::Lite via the proxy command (different from the Proxy setting - I know its confusing), its pretty simple:
Example 1:
$soap->proxy('http://endpoint.server/', proxy => ['http' => 'http://my.proxy.server/']);
The first proxy is the address for the SOAP server, and the second proxy is the Proxy settings. My problem is when I connect to SOAP::Lite with service description (WSDL), I have no idea where I can add Proxy settings. The code looks like this:
Example 2:
use SOAP::Lite; print SOAP::Lite -> service('http://www.xmethods.net/sd/StockQuoteService.wsdl') -> getQuote('MSFT');
When I try to add the Proxy settings like in eg. 1 I get an error message. I've scanned the documentation and the Guide but couldn't find anything. Does anybody know of a workaround where I can somehow add the Proxy settings?
Much obliged,
mrguy123

P.S: I will also be posting this question in the SOAP::Lite newsgroup and will update if any info comes from that side.

Replies are listed 'Best First'.
Re: SOAP::Lite and proxy settings
by doowah2004 (Monk) on Nov 01, 2006 at 16:09 UTC
    Have you tried:
    use SOAP::Lite; print SOAP::Lite -> proxy('http://my.proxy.server/') -> service('http://www.xmethods.net/sd/StockQuoteService.wsdl') -> getQuote('MSFT');
      Yes. It thinks its the SOAP::Lite proxy, and not the Proxy settings. I get this message: proxy: transport protocol not specified
        I am not getting that error. Hmmm... What version of perl are you using? SOAP::Lite? I did a quick search and found this:
        hi, i posted this message to the yahoo group about soap, but i thought i +'d cover all the bases. here's my posted mesg: After using SOAP::Lite with Perl 5.6.1, I discovered a bug in the software. the problem seems to be with the regex engine and the lines: $_[0] =~ /^(\w+):/ or die "proxy: transport protocol not specified\n +"; my $protocol = uc $1; # untainted now the problem is that the $1 appears to be interpolated in the wrong context. the uc call ends up being AUTOLOAD'ed and calling proxy->ToUpper from the utf8_heavy library. I must confess ignorance as to why this occurs, but here's a super easy patch that will solves the problem for 5.6.1 and will work in 5.005 versions too: it's just wrapping the $1 in a join() to force string context. --- Lite.pm.orig Wed Jun 27 13:28:08 2001 +++ Lite.pm.new Wed Jun 27 15:50:14 2001 @@ -120,7 +120,8 @@ return $self->{_proxy} unless @_; $_[0] =~ /^(\w+):/ or die "proxy: transport protocol not specified\ +n"; - my $protocol = uc $1; # untainted now + ## need to join $1 to force string context in 5.6.1 + my $protocol = uc(join("",$1)); # untainted now # https: should be done through Transport::HTTP.pm for ($protocol) { s/^HTTPS$/HTTP/ } Cheers dave viner
Re: SOAP::Lite and proxy settings
by jhourcle (Prior) on Nov 01, 2006 at 19:53 UTC

    I was messing with something similar yesterday (in trying to adjust the transport, where I was getting the other connection info from a wsdl)

    Unfortunately, I had no luck, and resorted to giving up on the wsdl, and going back to specifying the proxy and uri instead.

    I was going with a different approach, however, if you'd like to try the logic I was using, but you'll have to rework part of SOAP::Lite:

    use SOAP::Lite; my $soap = SOAP::Lite->service( $wsdl_url ); $soap->transport()->credentials( $hostid, $realm, $user, $pass );

    The problem is that the transport hasn't been fully initialized yet, so there's no LWP::UserAgent (or whatever your transport is) to start fiddling with.

    In my case, I had a workaround (place the user/password in the proxy string), so ended up going that route, but it kept me from being able to use the wsdl directly.

    To get my logic to work, you'd probably have to find where the transport gets initialized, and force that to run earlier (I'd do it myself, but I'm bogged down with more pressing concerns this week (month?).)