File: hello_lite.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 (29 lines) | stat: -rw-r--r-- 798 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
#!/usr/bin/perl -w
#use strict;
use warnings;
use SOAP::Lite; # +trace;

# I have to lookup the URL from the WSDL
my $soap = SOAP::Lite->new(
    proxy => 'http://localhost:81/soap-wsdl-test/helloworld.pl'
);

# I have to lookup the SOAPAction from the WSDL
$soap->on_action( sub { "urn:HelloWorld#sayHello" });
$soap->autotype(0);

# I have to lookup the top level element's namespace from the WSDL
$soap->default_ns('urn:HelloWorld');

# I have to encode all parameters as SOAP::Data objects
# I have to know the order of parameters
my $som = $soap->call(
    "sayHello",
    SOAP::Data->name('name')->value( $ARGV[1] || '"Your name"'),
    SOAP::Data->name('givenName')->value( $ARGV[0] || '"Your given name"'),
);

die $som->fault->{ faultstring } if ($som->fault);

print $som->result, "\n";