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.

In reply to Re^3: Dynamic Language questions by philcrow
in thread Dynamic Language questions by talexb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.