SOAP Server (CGI)


SOAP::Lite can be used to create a SOAP using your webserver and the CGI. Here is an example of a server that could respond to the client we just created.



     1	#!/usr/bin/perl
     2	
     3	use strict;
     4	use SOAP::Transport::HTTP;
     5	
     6	SOAP::Transport::HTTP::CGI
     7	    ->dispatch_to( 'xmethods-CurrencyExchange' )
     8	    ->handle();
     9	
    10	package xmethods-CurrencyExhange;
    11	
    12	sub getRate {
    13	    my ($country1, $country2) = @_;
    14	    my $result = calculate( $country1, $country2 );
    15      return( SOAP::Data->name( 'Result' => $result )->type( 'float' );
    16  }