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

Hi Monks,

We have a firewall and the preferred method is to go through a proxy to get out. I have tried this:

$api->transport->proxy(http => $proxy);

which yielded:

FATAL ERROR:: proxy: transport protocol not specified

I have also tried other variations (as found at http://cookbook.soaplite.com/ and also in the SOAP::Lite PODs) which get the same result. In addition to this, I have tried:

$ENV{'HTTP_proxy'} = $proxy;
which got: FATAL ERROR:: 500 Connect failed: connect: Connection refused; Connection refused at...

So that appears to not even be setting it (our firewall doesn't seem to be acknowledging the proxy when I use this). The admins have tested out the firewall to check that it will actually pass through to the correct endpoints and they can't see the script even hitting the proxy. I have been searching around and I haven't found any examples where someone has tried this and succeeded, so I'm not sure what the correct solution is. Any assistance would be greatly appreciated. Thanks

Replies are listed 'Best First'.
Re: Unable to run SOAP::Lite client through firewall proxy
by Anonymous Monk on Mar 20, 2011 at 13:44 UTC
    transport->proxy is SOAP specific, its not your internet firewall proxy

    What you want is what SOAP::Lite honors, HTTP_Proxy

    Since something is going wrong, try getting to the internet with lwp-request (try the various options)

    If you can get through your firewall with lwp-request, turn on debugging in soap and try debugging that

      I found the resolution. A couple notes for others: It appears that since I was accessing the service through an https endpoint, I needed to specify the firewall proxy protocol as https. From what I had read previously, I had through that specifying http would cover it. Guess not, perhaps I misunderstood. For one of the scripts, I was using a stubmaker.pl-generated pm which wrapped the various actions. As such, it was proving difficult to get access to the underlying http/https calls from within my script. I edited the pm _call() sub:
      sub _call { my ($self, $method) = (shift, shift); my $name = UNIVERSAL::isa($method => 'SOAP::Data') ? $method->name + : $method; my %method = %{$methods{$name}}; # added the following line so that we can utilize a proxy to get o +ut through # the firewall $self->proxy($method{endpoint}, proxy => ['https' => 'http://proxy +.mycompany.com']); $self->proxy($method{endpoint} || Carp::croak "No server address ( +proxy) specified") unless $self->proxy; my @templates = @{$method{parameters}}; ...
      perhaps that was a bit less-than-elegant, but I was under the gun and can use my learnings to build on in the future Thanks!