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

Monks,

I'm currently using SOAP::Lite as a part of a larger application to tie together a set of modules that are distributed over a number of remote machines.

As a part of this, I'd like to be able to have a configuration file somewhere with

$SOAP_SERVER = "http://my.server.com/"; $SOAP_PROXY = $SOAP_SERVER . "soap/soap_server.cgi";
in it to allow all of the "likey-to-change" configuration data to be centralised.

When I attempt to access a SOAP object using these configuration variables, however, I get an error simply saying proxy: transport protocol not specified, using the code below:

$db = SOAP::Lite -> uri ( $SOAP_SERVER . "dbAccessor" ) -> proxy( $SOAP_PROXY );

If I replace the $SOAP_* variables with their contents, the code executes perfectly.

Does anyone know of a way around this? Is it simply impossible to dynamically assign a SOAP server and proxy?

Any advice would be appreciated.

Thanks in advance.

Replies are listed 'Best First'.
Re: Dynamically setting a proxy for SOAP::Lite
by iburrell (Chaplain) on Feb 18, 2004 at 20:32 UTC
    Make sure that $SOAP_SERVER and $SOAP_PROXY have been loaded from the config file. You are getting errors on certain values that should work, always print out the real values.

    The uri and proxy methods for SOAP::Lite should not care if their parameters are literal strings or scalars. This should work fine:

    my $uri = $SOAP_SERVER . 'dbAccessor'; my $proxy = $SOAP_PROXY; my $soap = SOAP::Lite->new(); $soap->uri($uri); $soap->proxy($proxy);

    BTW, I put in an explicit constructor and removed the chainging. The SOAP::Lite modules uses the style of implicitly constructing objects and chaining them together. This makes it hard to tell when objects get constructed and what object is being used.

Re: Dynamically setting a proxy for SOAP::Lite
by Anonymous Monk on Feb 19, 2004 at 07:34 UTC