File: WSDL.t

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 (74 lines) | stat: -rw-r--r-- 2,477 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
use strict;
use warnings;
use Test::More tests => 13;
use File::Spec;
use File::Basename qw(dirname);
use_ok qw(SOAP::WSDL);

my $path = File::Spec->rel2abs(dirname( __FILE__ ) );
$path =~s{\\}{/}xmsg;   # fix for windows
my $soap = SOAP::WSDL->new();
$soap->wsdl("file://$path/WSDL_NOT_FOUND.wsdl");

eval { $soap->wsdlinit() };
like $@, qr{ does \s not \s exist }x, 'does not exist';

eval { $soap = SOAP::WSDL->new(
    wsdl => "file://$path/WSDL_NOT_FOUND.wsdl");
};
like $@, qr{ does \s not \s exist }x, 'does not exist (constructor)';

$soap = SOAP::WSDL->new();
$soap->wsdl( "file://$path/WSDL_EMPTY_DEFINITIONS.wsdl");
eval { $soap->wsdlinit() };
like $@, qr{ unable \s to \s extract \s schema \s from \s WSDL }x, 'empty definition';

# Try out all call() variants
eval { $soap->call('NewOperation', 'value'); };
like $@, qr{ unable \s to \s extract \s schema \s from \s WSDL }x, 'empty definition';

$soap = SOAP::WSDL->new();
$soap->wsdl( "file://$path/WSDL_NO_MESSAGE.wsdl");
eval { $soap->wsdlinit() };
# eval { $soap->call('NewOperation', 'value'); };
like $@, qr{ Message \s \{http://www.example.org/WSDL_1/\}NewOperationRequest \s not \s found }x, 'empty definition';

$soap = SOAP::WSDL->new();
$soap->wsdl( "file://$path/WSDL_1.wsdl");
$soap->wsdlinit();
$soap->no_dispatch(1);

like $soap->call('NewOperation', NewOperation => { in => 'test' }), qr{ <in>test</in> }x;
like $soap->call('NewOperation', { NewOperation => { in => 'test' } }), qr{ <in>test</in> }x;

$soap->set_proxy('http://foo.de', timeout => 256);
is $soap->get_client->get_transport()->timeout(), 256, 'timeout';

$soap = SOAP::WSDL->new( wsdl => "file://$path/WSDL_1.wsdl",
    servicename => 'NewService',
    portname => 'NewPort',
    no_dispatch => 1,
    keep_alive => 1,
);
$soap->proxy('http://example.org');
like $soap->call('NewOperation', NewOperation => { in => 'test' }), qr{ <in>test</in> }x;
like $soap->call('NewOperation', { NewOperation => { in => 'test' } }), qr{ <in>test</in> }x;


eval {
    $soap = SOAP::WSDL->new( wsdl => "file://$path/WSDL_NO_BINDING.wsdl",
        servicename => 'NewService',
        portname => 'NewPort',
        no_dispatch => 1,
    );
};
like $@, qr{ no \s binding }x, 'No binding error';

eval {
    $soap = SOAP::WSDL->new( wsdl => "file://$path/WSDL_NO_PORTTYPE.wsdl",
        servicename => 'NewService',
        portname => 'NewPort',
        no_dispatch => 1,
    );
};
like $@, qr{ cannot \s find \s portType  }x, 'No porttype error';