File: helloworld.pl

package info (click to toggle)
libsoap-wsdl-perl 3.004-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,600 kB
  • sloc: perl: 8,433; xml: 1,769; java: 19; makefile: 15
file content (57 lines) | stat: -rwxr-xr-x 1,251 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/perl -w
package main;
use strict;
use warnings;
use lib '../../lib';
use lib '../lib';
use MyServer::HelloWorld::HelloWorldSoap;

my $soap = MyServer::HelloWorld::HelloWorldSoap->new({
    dispatch_to => 'main',
});

$soap->handle();

sub sayHello {
    my ($self, $body, $header) = @_;
    my $name = $body->get_name();
    my $givenName = $body->get_givenName();

    return MyElements::sayHelloResponse->new({
        sayHelloResult => "Hello $givenName $name"
    })
}

=pod

=head1 NAME

helloworld.pl - a simple CGI-based SOAP server implementing the service from
in examples/wsdl/helloworld.wsdl

=head1 USAGE

Before using this script, you should secure your webserver. The easiest way
to do so is to let it listen to 127.0.0.1 only.

Then make a ScriptAlias named /soap-wsdl-test/ pointing at the directory
this file lies in.

For my apache, it looks like this:

 ScriptAlias /soap-wsdl-test/ /home/martin/workspace/SOAP-WSDL/example/cgi-bin/
 <Directory "/home/martin/workspace/SOAP-WSDL/example/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews
    Order allow,deny
    Allow from all
 </Directory>

Then run the helloworld.pl from the examples directory. It should print

 Hello World

=head1 DESCRIPTION

=cut