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

Hi, Last few weeks im implemeting webservice in my localmachine. I succeed with the basic function call. Now im trying with wsdl file with xml responce. i refered the WSDL::Generator module and i created a wsdl file with the following procecure.

cat /var/www/cgi-bin/WorldFunction.pm

package WorldFunctions; sub new { bless {}, shift; } sub Hello { my ($s, $name) = @_; return 'Hello, ' . $name . "\n"; } sub GoodBye { my ($s, $name) = @_; return 'Goodbye, ' . $name . "\n"; } 1;

cat /var/www/cgi-bin/lib/CLASS/World.pm

package CLASS::World; use SOAP::Transport::HTTP; my $server = SOAP::Transport::HTTP::Apache -> dispatch_to('WorldFunctions'); sub handler { $server->handler(@_); } package WorldFunctions; sub new { bless {}, shift; } sub Hello { my ($s, $name) = @_; return 'Hello, ' . $name . "\n"; } sub GoodBye { my ($s, $name) = @_; return 'Goodbye, ' . $name . "\n"; } 1;

i configured apache file.( to acheive, ScriptAlias /world/ /var/www/cgi-bin/)

cat perl /var/www/cgi-bin/startup.pl

use WSDL::Generator; my $init = { 'schema_namesp' => 'http://localhost/WorldFunctions.xsd', 'services' => 'WorldFunctions', 'service_name' => 'WorldFunctions', 'target_namesp' => 'http://localhost/world/', 'documentation' => 'Simple Hello World SOAP Service.', 'location' => 'http://localhost/world }; my $w = WSDL::Generator->new($init); WorldFunctions->Hello('Joe'); WorldFunctions->GoodBye('Joe'); print $w->get(WorldFunctions);

then, perl startup.pl > /var/www/html/WorldFunctions.wsdl

then, wsdl2perl.pl -b lib http://localhost/WorldFunctions.wsdl

output,

Creating element class MyElements/GoodByeRequest.pm
Creating element class MyElements/GoodByeResponse.pm
Creating element class MyElements/HelloRequest.pm
Creating element class MyElements/HelloResponse.pm
Creating typemap class MyTypemaps/WorldFunctions.pm
Creating interface class MyInterfaces/WorldFunctions/WorldFunctionsWorldFunctionsPort.pm

It that correct way to go? if ok, please tell me how to implement the server to go ahead.(please don't try to redirect me into some tutorial, i gone through lot of site but i couldn't get it)