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

Changing endpoint from a full wsdl file

Expand Messages
  • Weidong Wang
    I need to write client code that uses a wsdl file to start talking to a server. The response from the server will carry new post URI for the next call to post
    Message 1 of 4 , Sep 27, 2002
    • 0 Attachment
      I need to write client code that uses a wsdl file to start talking to a server. The response from the server will carry new post URI for the next call to post to. For example, the WSDL gives the following endpoint:
       
       
      and the response contains a link http://temp.org/soap/accounts and this is the URI I need to post to.
       
      Looking through the old archive, I found a response from Paul a while ago after doing such change for tModel WSDL file, and the saying that it is hard to do it for the full WSDL where the service endpoint is specified already.
       
      I tried to use proxy() to set it, it does not work. How can this be done?
       
      Here is a breif of my code:
       
      $soap = SOAP::Lite->serivice($wsdlfile);
      $result = $soap->Func(); // first call
      ...
      # parse the result to get the new URI
      $soap->proxy($newProxyURI);
      $result = $soap->Func(); // 2nd call
       
      Thanks.
       
      Weidong
       
       
    • Randy J. Ray
      ... The problem is that the WSDL parsing code creates wrapper routines for each of the operations defined in the WSDL file. These wrappers explicitly set the
      Message 2 of 4 , Sep 27, 2002
      • 0 Attachment
        On 2002.09.27 16:02 Weidong Wang wrote:
        > I need to write client code that uses a wsdl file to start talking to a
        > server. The response from the server will carry new post URI for the next
        > call to post to. For example, the WSDL gives the following endpoint:
        >
        > http://temp.org/soap
        >
        > and the response contains a link http://temp.org/soap/accounts and this is
        > the URI I need to post to.

        The problem is that the WSDL parsing code creates wrapper routines for each of
        the operations defined in the WSDL file. These wrappers explicitly set the URI
        before making the call, from within the wrappers themselves. So manually
        setting the URI is lost. And I can't offer a solution that wouldn't involve a
        big hack to SOAP::Lite, which I lack the time for at this point :-). Sorry.

        Randy
        --
        rjray@... Linux: Because rebooting is for adding new hardware.

        Any spammers auto-extracting addresses from this message will definitely want
        to include uce@... and report@...
      • Paul Kulchenko
        Hi Weidong, Randy is right. if WSDL doesn t include an endpoint, then manual call will make the trick: my $service = SOAP::Lite -
        Message 3 of 4 , Sep 27, 2002
        • 0 Attachment
          Hi Weidong,

          Randy is right. if WSDL doesn't include an endpoint, then manual call
          will make the trick:

          my $service = SOAP::Lite
          ->
          service('http://services.xmethods.net/soap/urn:xmethods-delayed-quotes.wsdl');

          $service->proxy('http://foo/'); # <<<
          print $service->getQuote('MSFT'), "\n";

          If WSDL includes the endpoint, you can overwrite the endpoint()
          method to return the endpoint you want:

          sub SOAP::Lite::endpoint { return shift if @_ > 1; 'http://foo/' }

          That's the shortest solution I can come up with. Let me know if it
          doesn't work for you.

          Best wishes, Paul.

          --- "Randy J. Ray" <rjray@...> wrote:
          > On 2002.09.27 16:02 Weidong Wang wrote:
          > > I need to write client code that uses a wsdl file to start
          > talking to a
          > > server. The response from the server will carry new post URI for
          > the next
          > > call to post to. For example, the WSDL gives the following
          > endpoint:
          > >
          > > http://temp.org/soap
          > >
          > > and the response contains a link http://temp.org/soap/accounts
          > and this is
          > > the URI I need to post to.
          >
          > The problem is that the WSDL parsing code creates wrapper routines
          > for each of
          > the operations defined in the WSDL file. These wrappers explicitly
          > set the URI
          > before making the call, from within the wrappers themselves. So
          > manually
          > setting the URI is lost. And I can't offer a solution that wouldn't
          > involve a
          > big hack to SOAP::Lite, which I lack the time for at this point
          > :-). Sorry.
          >
          > Randy
          > --
          > rjray@... Linux: Because rebooting is for adding
          > new hardware.
          >
          > Any spammers auto-extracting addresses from this message will
          > definitely want
          > to include uce@... and report@...
          >
          > ------------------------ Yahoo! Groups Sponsor
          >
          > To unsubscribe from this group, send an email to:
          > soaplite-unsubscribe@yahoogroups.com
          >
          >
          >
          > Your use of Yahoo! Groups is subject to
          > http://docs.yahoo.com/info/terms/
          >
          >


          __________________________________________________
          Do you Yahoo!?
          New DSL Internet Access from SBC & Yahoo!
          http://sbc.yahoo.com
        • Weidong Wang
          Thanks, Paul and Randy. ... Paul, I tried it. I can put it anywhere in my code or library. When running, Perl will complain that SOAP::Lite::endpoint is
          Message 4 of 4 , Sep 28, 2002
          • 0 Attachment
            Thanks, Paul and Randy.

            > If WSDL includes the endpoint, you can overwrite the endpoint()
            > method to return the endpoint you want:
            >
            > sub SOAP::Lite::endpoint { return shift if @_ > 1; 'http://foo/' }
            >
            > That's the shortest solution I can come up with. Let me know if it
            > doesn't work for you.

            Paul, I tried it. I can put it anywhere in my code or library. When running, Perl will complain that SOAP::Lite::endpoint is redefined, but then it will use the new endpoint in this call.

            But it seems to me that having this sub will affect all WSDL calls, correct? In my app, I need to use multiple WSDL files for making different service calls. I suppose the existence of this sub will make all wrapper functions generated by service() call to use the new endpoint.

            It seesm to me if we can dynamically redefine this sub as needed and rerun service() call (much more overhead of course), we might be able to get around it?

            I will look into having the tModel kind of WSDL file.

            Thanks.

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