Loading ...
Sorry, an error occurred while loading the content.

Re: Need help with proxy setting

Expand Messages
  • Edi Goetschel
    ... Both, LWP::UserAgent and SOAP::Lite? As Newbie I m lost in code... I tried this without success: #!/path/to/perl -w use SOAP::Lite; my $s = SOAP::Lite -
    Message 1 of 7 , Feb 4, 2005
    • 0 Attachment
      > You need to pass some parameters that will be passed through to
      > LWP::UserAgent. I think that the syntax is somethning like
      >
      > SOAP::Lite->proxy('http://xxx.com', proxy => {http =>
      > 'your.http.proxy'});

      Both, LWP::UserAgent and SOAP::Lite? As Newbie I'm lost in code...

      I tried this without success:

      #!/path/to/perl -w

      use SOAP::Lite;

      my $s = SOAP::Lite
      -> uri('urn:XXX')
      -> proxy('http://to/the/webService',
      proxy => 'http://my.proxy:80');

      And I tried this:

      #!/path/to/perl -w

      use LWP::UserAgent;
      use SOAP::Lite;

      $ua = new LWP::UserAgent;
      $ua->proxy('http' => 'http://my.proxy:80');

      my $s = SOAP::Lite
      -> uri('urn:XXX')
      -> proxy('http://to/the/webService',
      proxy=>$ua);


      The error message for the second is:

      Not an ARRAY reference at /path/to/LWP/UserAgent.pm

      How have I to construct this?

      Edi
    • h2ofaull
      I m having the same problem with proxies... In Windows, I only have to set the environment variable http_proxy and SOAP::Lite does the right thing. On my
      Message 2 of 7 , Feb 4, 2005
      • 0 Attachment
        I'm having the same problem with proxies...

        In Windows, I only have to set the environment variable "http_proxy"
        and SOAP::Lite does the right thing. On my Debian GNU/Linux box,
        however, SOAP::Lite does not respect my "http_proxy" environment
        variable (verified with Ethereal). Other programs (e.g., wget) use
        the http_proxy environment variable, so I've got it set properly.

        Versions don't seem to be the issue - I'm using v0.55 in Windows and
        v0.65beta2 on Debian, but I tried v0.55 in Debian with the same behavior.

        Whoever finds a solution to this - please post! I'll do the same.
        Race you. :)

        -brian


        --- In soaplite@yahoogroups.com, "Edi Goetschel" <egoetschel@y...> wrote:
        >
        > > You need to pass some parameters that will be passed through to
        > > LWP::UserAgent. I think that the syntax is somethning like
        > >
        > > SOAP::Lite->proxy('http://xxx.com', proxy => {http =>
        > > 'your.http.proxy'});
        >
        > Both, LWP::UserAgent and SOAP::Lite? As Newbie I'm lost in code...
        >
        > I tried this without success:
        >
        > #!/path/to/perl -w
        >
        > use SOAP::Lite;
        >
        > my $s = SOAP::Lite
        > -> uri('urn:XXX')
        > -> proxy('http://to/the/webService',
        > proxy => 'http://my.proxy:80');
        >
        > And I tried this:
        >
        > #!/path/to/perl -w
        >
        > use LWP::UserAgent;
        > use SOAP::Lite;
        >
        > $ua = new LWP::UserAgent;
        > $ua->proxy('http' => 'http://my.proxy:80');
        >
        > my $s = SOAP::Lite
        > -> uri('urn:XXX')
        > -> proxy('http://to/the/webService',
        > proxy=>$ua);
        >
        >
        > The error message for the second is:
        >
        > Not an ARRAY reference at /path/to/LWP/UserAgent.pm
        >
        > How have I to construct this?
        >
        > Edi
      • h2ofaull
        Got something... but perhaps I m talking to myself anymore... :) I can t figure out how to get the SOAP::Lite- service() syntax to work, when going through a
        Message 3 of 7 , Feb 4, 2005
        • 0 Attachment
          Got something... but perhaps I'm talking to myself anymore... :)

          I can't figure out how to get the SOAP::Lite->service() syntax to
          work, when going through a proxy server. (Please help!) I've found
          of a couple workarounds, both of which are undesirable!

          Here's 2 solutions, then a full recap of the problem:

          Instead of using the very handy, lovely, wonderful, happy, WSDL
          description using SOAP::Lite->service(), use the uglier version:

          print SOAP::Lite
          -> uri('urn:xmethods-delayed-quotes')
          -> proxy('http://services.xmethods.net/soap',
          proxy => [http => 'http://my-proxy:80'])
          -> getQuote('MSFT')
          -> result;

          Found that syntax from the SOAP::Lite documentation at
          http://cpan.uwinnipeg.ca/htdocs/SOAP-Lite/SOAP/Lite.html - somewhat
          buried...

          I don't understand why "proxy" in the first (method) case means
          "endpoint URI" and "proxy" in the second (unnamed hash, key) really
          means "proxy server".

          So, the "proxy" method of SOAP::Lite allows a further argument of
          proxy server[s], but service() doesn't...

          Second (untested) use WGET or something to grab the WSDL, then use the
          service() method on the LOCALLY STORED WSDL.

          A recap...

          The problem again: the UNIX distribution appears to ignore the
          environment variable 'http_proxy', whereas Windows finds and uses it
          when trying to access a SOAP service on the other side of a firewall.

          The behavior: I have a proxy server, http://my-proxy:80, that all my
          http traffic wants to go through. I want to use this syntax - yanked
          directly from http://guide.soaplite.com

          print SOAP::Lite
          -> service('http://www.xmethods.net/sd/StockQuoteService.wsdl')
          -> getQuote('MSFT');

          But since I have a proxy server, I simply do a...

          set http_proxy=http://my_proxy:80

          in my shell from which I'm executing this code. This works in Windows
          with SOAP::Lite v0.55.

          I try to port my client Debian GNU/Linux and the above code hangs,
          even if I do an

          export http_proxy=http://my_proxy:80

          in the shell to identify my http proxy (for bash). wget and other
          apps find the http_proxy variable just fine...

          So anyway, I don't know if it's just my install or if it's Debian or
          what's screwing me, but one way around it is above.

          I've tried a number of different permutations to specify the proxy in
          other ways, but I this is the best I can do so far.

          I hope this helps someone!
          -brian



          --- In soaplite@yahoogroups.com, "h2ofaull" <h2ofaull@y...> wrote:
          >
          > I'm having the same problem with proxies...
          >
          > In Windows, I only have to set the environment variable "http_proxy"
          > and SOAP::Lite does the right thing. On my Debian GNU/Linux box,
          > however, SOAP::Lite does not respect my "http_proxy" environment
          > variable (verified with Ethereal). Other programs (e.g., wget) use
          > the http_proxy environment variable, so I've got it set properly.
          >
          > Versions don't seem to be the issue - I'm using v0.55 in Windows and
          > v0.65beta2 on Debian, but I tried v0.55 in Debian with the same
          behavior.
          >
          > Whoever finds a solution to this - please post! I'll do the same.
          > Race you. :)
          >
          > -brian
          >
          >
          > --- In soaplite@yahoogroups.com, "Edi Goetschel" <egoetschel@y...>
          wrote:
          > >
          > > > You need to pass some parameters that will be passed through to
          > > > LWP::UserAgent. I think that the syntax is somethning like
          > > >
          > > > SOAP::Lite->proxy('http://xxx.com', proxy => {http =>
          > > > 'your.http.proxy'});
          > >
          > > Both, LWP::UserAgent and SOAP::Lite? As Newbie I'm lost in code...
          > >
          > > I tried this without success:
          > >
          > > #!/path/to/perl -w
          > >
          > > use SOAP::Lite;
          > >
          > > my $s = SOAP::Lite
          > > -> uri('urn:XXX')
          > > -> proxy('http://to/the/webService',
          > > proxy => 'http://my.proxy:80');
          > >
          > > And I tried this:
          > >
          > > #!/path/to/perl -w
          > >
          > > use LWP::UserAgent;
          > > use SOAP::Lite;
          > >
          > > $ua = new LWP::UserAgent;
          > > $ua->proxy('http' => 'http://my.proxy:80');
          > >
          > > my $s = SOAP::Lite
          > > -> uri('urn:XXX')
          > > -> proxy('http://to/the/webService',
          > > proxy=>$ua);
          > >
          > >
          > > The error message for the second is:
          > >
          > > Not an ARRAY reference at /path/to/LWP/UserAgent.pm
          > >
          > > How have I to construct this?
          > >
          > > Edi
        • Duncan Cameron
          Hi Brian ... In the docs for the SOAP::Transport::HTTP package there is an example of how to use an http proxy. ... The extra parameters to proxy are passed to
          Message 4 of 7 , Feb 5, 2005
          • 0 Attachment
            Hi Brian

            >Got something... but perhaps I'm talking to myself anymore... :)
            >
            >I can't figure out how to get the SOAP::Lite->service() syntax to
            >work, when going through a proxy server. (Please help!) I've found
            >of a couple workarounds, both of which are undesirable!
            >
            >Here's 2 solutions, then a full recap of the problem:
            >
            >Instead of using the very handy, lovely, wonderful, happy, WSDL
            >description using SOAP::Lite->service(), use the uglier version:
            >
            > print SOAP::Lite
            > -> uri('urn:xmethods-delayed-quotes')
            > -> proxy('http://services.xmethods.net/soap',
            > proxy => [http => 'http://my-proxy:80'])
            > -> getQuote('MSFT')
            > -> result;
            >
            >Found that syntax from the SOAP::Lite documentation at
            >http://cpan.uwinnipeg.ca/htdocs/SOAP-Lite/SOAP/Lite.html - somewhat
            >buried...

            In the docs for the SOAP::Transport::HTTP package there is an example
            of how to use an http proxy.

            >I don't understand why "proxy" in the first (method) case means
            >"endpoint URI" and "proxy" in the second (unnamed hash, key) really
            >means "proxy server".
            >
            The extra parameters to proxy are passed to the SOAP::Transport
            object and are treated as parameters to LWP::UserAgent, which is the
            class used by S::L for the HTTP client. If you look at the docs for
            LWP::UserAgent then you will see the reason for the syntax and also
            other parameters that can be specified, such as the HTTP timeout.

            It is unfortunate that proxy is used by S::L to simply mean 'the
            endpoint to connect to'.

            >So, the "proxy" method of SOAP::Lite allows a further argument of
            >proxy server[s], but service() doesn't...
            >
            >Second (untested) use WGET or something to grab the WSDL, then use
            >the
            >service() method on the LOCALLY STORED WSDL.
            >
            >A recap...
            >
            >The problem again: the UNIX distribution appears to ignore the
            >environment variable 'http_proxy', whereas Windows finds and uses it
            >when trying to access a SOAP service on the other side of a firewall.

            Again, it is the LWP package that uses the environment
            variables, not S::L.

            A quick look at the code in SOAP/Transport/HTTP.pm shows that S::L is
            expecting the environment variable to be 'HTTP_proxy'. Linux is cases
            sentitive, while Windows isn't. I'm not sure why it has been made
            case sensitive as LWP::UserAgent isn't.

            Duncan
          Your message has been successfully submitted and would be delivered to recipients shortly.