in reply to Problems creating a SOAP::Lite client

First off, please close your <code> tag.

Next, you're missing the implicit BEGIN there. Remember that use is a require and import inside a BEGIN block. What that means is that your use line is executing outside the eval, and before $proxy is initialised. Putting your initialisation inside another BEGIN block would work.

my ($uri, $proxy, $result); BEGIN { $uri = "tcp://$server/ENG/AddressManagement/NameServerManagement"; $proxy = 'tcp://rheise-linux:82'; } use SOAP::Lite ...;
Hope that helps,

Replies are listed 'Best First'.
Re^2: Problems creating a SOAP::Lite client
by robert.heise (Initiate) on Nov 13, 2006 at 15:12 UTC
    Thanks for your ideas. The problem is that I need to dynamically create both the proxyURI and the bindingURI as this application will hit multiple servers. I dont think using BEGIN will work since I need the uri and proxy fields to support multiple connection points during the runtime of the script itself. Is there a way to use autodispatch and not use  use SOAP::Lite ? This way I could create a SOAP::Lite object in main, and recall that object over the lifecycle of the script passing in different proxy and bind paths? Thanks Rob

      Why do you need autodispatch? There appears to be a tradeoff here. On one hand is autodispatch for when you have the proxy info at compile time. On the other is the regular dispatch where you can specify all that exactly where you need it, but can do so dynamically.

      It appears that you want your cake and you want to eat it, too. From a cursory glance at the SOAP::Lite docs, it does not appear that SOAP::Lite allows for that.

      That said, you might be able to do your own imports...

      use SOAP::Lite; SOAP::Lite->import(autodispatch => uri => $uri, proxy => $proxy, # etc... );
      That might work - hopefully there aren't any functions with prototypes in there ... although I have to admit that I doubt that to be the case. There may be other gotchas, too, I'm not sure.