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

SOAP::Lite and Proxies

Expand Messages
  • Mick Watson
    Hi OK I know I can t be the only person having trouble with SOAP::Lite and proxies! My very simple script is trying to access the KEGG API. It looks like
    Message 1 of 6 , Dec 4, 2003
    • 0 Attachment
      Hi

      OK I know I can't be the only person having trouble with SOAP::Lite and
      proxies!

      My very simple script is trying to access the KEGG API. It looks like this:

      #!/usr/local/bin/perl
      use SOAP::Lite;
      $url = 'http://soap.genome.ad.jp/KEGG.wsdl';

      my $response = SOAP::Lite
      -> service("$url")
      -> proxy('http://wwwcache.bbsrc.ac.uk:8080')
      -> get_pathways_by_enzymes(['ec:1.3.99.1']);

      foreach (@{$response}) {
      print "$_->{'kid1'}\t$_->{'kid2'}\t$_->{'sw_score'}\n";
      }

      This script basically times out. The message I get back is:

      Service description 'http://soap.genome.ad.jp/KEGG.wsdl' can't be
      loaded: 500 Can't connect to soap.genome.ad.jp:80 (connect: timeout)

      Now here's the thing - if I use my browser, then
      http://soap.genome.ad.jp/KEGG.wsdl can be accessed perfectly, and I
      can connect to soap.genome.ad.jp:80. And my browser uses
      http://wwwcache.bbsrc.ac.uk:8080 as the proxy. Sooooo, to conclude:

      My browser can connect to the resource using my proxy
      SOAP::Lite cannot connect to the resource using my proxy
      SOAP::Lite must be doing something different to what my browser does
      that makes it not work.

      Anyone have a clue what that might be?

      Thanks

      Mick
    • Duncan Cameron
      ... SOAP::Lite uses the word proxy to mean the remote server that you are connecting to, not a HTTP proxy as you may understand it. Not sure why the term was
      Message 2 of 6 , Dec 4, 2003
      • 0 Attachment
        At 16:54:05 on 2003-12-04 Mick Watson <michael.watson@...> wrote:

        >OK I know I can't be the only person having trouble with SOAP::Lite and
        >proxies!
        >
        >My very simple script is trying to access the KEGG API. It looks like this:
        >
        >#!/usr/local/bin/perl
        >use SOAP::Lite;
        >$url = 'http://soap.genome.ad.jp/KEGG.wsdl';
        >
        >my $response = SOAP::Lite
        > -> service("$url")
        > -> proxy('http://wwwcache.bbsrc.ac.uk:8080')
        > -> get_pathways_by_enzymes(['ec:1.3.99.1']);
        >
        >foreach (@{$response}) {
        > print "$_->{'kid1'}\t$_->{'kid2'}\t$_->{'sw_score'}\n";
        >}
        >
        >This script basically times out. The message I get back is:
        >
        >Service description 'http://soap.genome.ad.jp/KEGG.wsdl' can't be
        >loaded: 500 Can't connect to soap.genome.ad.jp:80 (connect: timeout)
        >
        >Now here's the thing - if I use my browser, then
        >http://soap.genome.ad.jp/KEGG.wsdl can be accessed perfectly, and I
        >can connect to soap.genome.ad.jp:80. And my browser uses
        >http://wwwcache.bbsrc.ac.uk:8080 as the proxy. Sooooo, to conclude:
        >
        >My browser can connect to the resource using my proxy
        >SOAP::Lite cannot connect to the resource using my proxy
        >SOAP::Lite must be doing something different to what my browser does
        >that makes it not work.
        >
        >Anyone have a clue what that might be?
        SOAP::Lite uses the word 'proxy' to mean the remote server that you
        are connecting to, not a HTTP proxy as you may understand it. Not sure
        why the term was chosen.
        See the SOAP::Transport::HTTP section of the docs for how to use
        a HTTP proxy, I think that you can also use environment variables as
        it is all handled by the LWP::UserAgent module.

        Regards
        Duncan
      • michael watson (IAH-C)
        Hi Duncan Thanks for your help, but unfortunately it didn t help! :-( The SOAP::Transport::HTTP documentation states that this is the way to set up your http
        Message 3 of 6 , Dec 5, 2003
        • 0 Attachment
          Hi Duncan

          Thanks for your help, but unfortunately it didn't help! :-(

          The SOAP::Transport::HTTP documentation states that this is the way to set up your http proxy for use with SOAP::Lite

          SOAP::Lite->proxy('http://endpoint.server/',
          proxy => ['http' => 'http://my.proxy.server']);

          So I have added this line to my script:

          SOAP::Lite->proxy('http://soap.genome.ad.jp:80',
          proxy => ['http' => 'http://wwwcache.bbsrc.ac.uk:8080']);

          'http://soap.genome.ad.jp:80' is the service I am trying to connect to and http://wwwcache.bbsrc.ac.uk:8080 is my proxy - and the script still times out with the message:

          Service description 'http://soap.genome.ad.jp/KEGG.wsdl' can't be loaded: 500 Can't connect to soap.genome.ad.jp:80 (connect: timeout)

          Now here is the thing - you say that if i have my environment set up properly then LWP::UserAgent handles everything. Well, that isn't the case here, because if I execute this script:

          #!/usr/bin/perl
          use LWP::Simple;
          my $kegg = get("http://soap.genome.ad.jp/KEGG.wsdl");
          print "$kegg\n";

          Then the KEGG.wsdl file is downloaded almost instantly. So SOAP::Lite cannot be using the same settings as LWP as LWP works instantly and SOAP::Lite can't connect. For completeness, here is my http_proxy environment variable:

          IAHC-LINUX03:/usr/users/mwatson # printenv | grep http_proxy
          http_proxy=http://wwwcache.bbsrc.ac.uk:8080

          Does anyone have any code showing how they use their proxy with SOAP::Lite successfully? Perhaps using a public service so I can check everything is working?

          Thanks in advance for your help

          Mick


          Duncan Wrote:

          SOAP::Lite uses the word 'proxy' to mean the remote server that you
          are connecting to, not a HTTP proxy as you may understand it. Not sure
          why the term was chosen.
          See the SOAP::Transport::HTTP section of the docs for how to use
          a HTTP proxy, I think that you can also use environment variables as
          it is all handled by the LWP::UserAgent module.

          Regards
          Duncan
        • Randy J. Ray
          ... This is a subtle but nasty bug you ve found, here. One I never noticed while writing the book, nor do I imagine Paul himself has come across it. If you set
          Message 4 of 6 , Dec 5, 2003
          • 0 Attachment
            > So I have added this line to my script:
            >
            > SOAP::Lite->proxy('http://soap.genome.ad.jp:80',
            > proxy => ['http' => 'http://wwwcache.bbsrc.ac.uk:8080']);
            >
            > 'http://soap.genome.ad.jp:80' is the service I am trying to connect to and
            > http://wwwcache.bbsrc.ac.uk:8080 is my proxy - and the script still times out
            > with the message:
            >
            > Service description 'http://soap.genome.ad.jp/KEGG.wsdl' can't be loaded: 500
            > Can't connect to soap.genome.ad.jp:80 (connect: timeout)

            This is a subtle but nasty bug you've found, here. One I never noticed while
            writing the book, nor do I imagine Paul himself has come across it.

            If you set the proxy the way you're supposed to for ordinary calls, that same
            proxy *isn't* used when SOAP::Lite tries to fetch the service WSDL description
            itself.

            This doesn't explain why your environment variable isn't helping, though. Is
            the service running under a different UID, like, say, the webserver?

            Randy
            --
            """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
            Randy J. Ray Campbell, CA http://www.rjray.org rjray@...

            Silicon Valley Scale Modelers: http://www.svsm.org
          • michael watson (IAH-C)
            ... Ummm, I am not sure what you mean. The service, http://soap.genome.ad.jp/KEGG.wsdl , is running at a remote server and is not within my control....
            Message 5 of 6 , Dec 5, 2003
            • 0 Attachment
              >This is a subtle but nasty bug you've found, here. One I never noticed while
              >writing the book, nor do I imagine Paul himself has come across it.
              >
              >If you set the proxy the way you're supposed to for ordinary calls, that same
              >proxy *isn't* used when SOAP::Lite tries to fetch the service WSDL description
              >itself.
              >
              >This doesn't explain why your environment variable isn't helping, though. Is
              >the service running under a different UID, like, say, the webserver?

              Ummm, I am not sure what you mean. The service, 'http://soap.genome.ad.jp/KEGG.wsdl',
              is running at a remote server and is not within my control....
            • michael watson (IAH-C)
              I am both amazed, overjoyed and disappointed at the same time ;-) This line in my perl script solved my problem: $ENV{HTTP_proxy} =
              Message 6 of 6 , Dec 5, 2003
              • 0 Attachment
                I am both amazed, overjoyed and disappointed at the same time ;-)
                This line in my perl script solved my problem:

                $ENV{HTTP_proxy} = "http://wwwcache.bbsrc.ac.uk:8080";

                Note that HTTP is in capitals. If i put it in lower case, it won't work.

                A rather odd little feature.... :-)

                Thanks
                Mick

                -----Original Message-----
                From: Randy J. Ray [mailto:rjray@...]
                Sent: 05 December 2003 10:25
                To: michael watson (IAH-C)
                Cc: soaplite@yahoogroups.com
                Subject: Re: [soaplite] SOAP::Lite and Proxies


                > So I have added this line to my script:
                >
                > SOAP::Lite->proxy('http://soap.genome.ad.jp:80',
                > proxy => ['http' => 'http://wwwcache.bbsrc.ac.uk:8080']);
                >
                > 'http://soap.genome.ad.jp:80' is the service I am trying to connect to and
                > http://wwwcache.bbsrc.ac.uk:8080 is my proxy - and the script still times out
                > with the message:
                >
                > Service description 'http://soap.genome.ad.jp/KEGG.wsdl' can't be loaded: 500
                > Can't connect to soap.genome.ad.jp:80 (connect: timeout)

                This is a subtle but nasty bug you've found, here. One I never noticed while
                writing the book, nor do I imagine Paul himself has come across it.

                If you set the proxy the way you're supposed to for ordinary calls, that same
                proxy *isn't* used when SOAP::Lite tries to fetch the service WSDL description
                itself.

                This doesn't explain why your environment variable isn't helping, though. Is
                the service running under a different UID, like, say, the webserver?

                Randy
                --
                """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
                Randy J. Ray Campbell, CA http://www.rjray.org rjray@...

                Silicon Valley Scale Modelers: http://www.svsm.org
              Your message has been successfully submitted and would be delivered to recipients shortly.