File: hello_compile.pl

package info (click to toggle)
libsoap-wsdl-perl 3.004-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,600 kB
  • sloc: perl: 8,433; xml: 1,769; java: 19; makefile: 15
file content (29 lines) | stat: -rw-r--r-- 1,143 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 XML::Compile::SOAP11;
use XML::Compile::WSDL11;
use XML::Compile::Transport::SOAPHTTP;

# I need access to the WSDL around - or use Data::Dumper::Streamer
# for serializing the generated closures into (big) perl files
my $wsdl = XML::Compile::WSDL11->new('wsdl/11_helloworld.wsdl');

# I compile a interface method for a single SOAP method from the WSDL
# I have to lookup the method names from the WSDL
# or use the provided script examining the WSDL
my $call = $wsdl->compileClient('sayHello');

# I have to lookup the parameters from the WSDL - can be quite tricky
# XML::Compile provides a script creating examples, so I can use that, too.
my $result = $call->(
    name => $ARGV[1] || '"Your name"',
    givenName => $ARGV[0] || '"Your given name"',
);

# XML::Compile::SOAP's client just returns undef in case of failure
die "Error calling soap method" if not defined $result;

# I have to lookup the output parameters from the WSDL - or try Data::Dumper
# XML::Compile provides a script creating examples, so I can use that, too.
print $result->{ parameters }->{ sayHelloResult }, "\n";