in reply to Re^2: Dynamic Language questions
in thread Dynamic Language questions

Here is the output from running the above script:
perl soapclient 98.6
Produces request:
<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://sunflower.com/soapns" xmlns:xs="http://www.w3.org/2001/XMLSchema" > <soap:Body> <tns:temperature> <tns:farenheit>98.6</tns:farenheit> </tns:temperature> </soap:Body> </soap:Envelope>
When the server has done its bit, the script prints the response:
<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs="http://www.w3.org/2001/XMLSchema" > <soap:Body> <GantrySoapServiceResponse xmlns="http://usegantry.org/soapservice"> <currentUTCTime>2007-05-15T12:08:18Z</currentUTCTime> <celcius>37</celcius> </GantrySoapServiceResponse> </soap:Body> </soap:Envelope>
The names of the parameters and their allowed types are usually governed by a WSDL file (perhaps that expands to Web Service Description Language, but I'm not sure of the achronymn).

Note well that you can convert the script to contact any document style service on the web by changing the URLs and providing the correct argument structure. For instance, I started this test against a public web service. I used:

my $site = { action_url => 'http://in2test.lsi.uniovi.es/sqlmutationws/getMutantsCompress +ed', post_to_url => 'http://in2test.lsi.uniovi.es/sqlmutationws/SQLMutationWS.asmx +', target_namespace => 'http://in2test.lsi.uniovi.es/sqlmutationws', };
and
my $request_args = [ { getMutantsCompressed => [ { sql => 'select * from table1' }, { schema => undef }, { options => undef }, ] }, ];
If you make those changes, and the public service is still up, you should get a result from anywhere on the net.

In case it might help with this question or some other question you didn't post, here is the code from the Gantry samples which serves the original script:

package Gantry::Samples::SOAP; use strict; use warnings; use Gantry qw{ -PluginNamespace=Gantry::Samples::SOAP SOAP::Doc }; our @ISA = ( 'Gantry' ); sub namespace { return 'Gantry::Samples::SOAP'; } sub do_f2c { my ( $self ) = @_; my $time = $self->soap_current_time(); my $params = $self->params(); # easy way my $f_temp = $params->{ farenheit }; my $celcius = 5.0 * ( $f_temp - 32 ) / 9.0; my $ret_struct = [ { GantrySoapServiceResponse => [ { currentUTCTime => $time }, { celcius => $celcius }, ] } ]; $self->soap_namespace_set( 'http://usegantry.org/soapservice' ); return $self->soap_out( $ret_struct, 'internal', 'pretty' ); } # END do_f2c 1;
If you have Gantry installed, that's a complete server module. All you need to do is mount it with mod_perl or some other server approach.

Thanks for taking the time to respond to the survey for all of us.

Phil

The Gantry Web Framework Book is now available.

Replies are listed 'Best First'.
Re^4: Dynamic Language questions
by Dice (Beadle) on May 15, 2007 at 14:06 UTC
    Your support (and everyone else's!) makes all the difference. Thanks for helping out.

    Cheers,
    Richard