[r419]: trunk / t / 22-interop_apache.t  Maximize  Restore  History

Download this file

134 lines (106 with data), 3.9 kB

  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
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/bin/env perl
BEGIN {
unless(grep /blib/, @INC) {
chdir 't' if -d 't';
unshift @INC, '../lib' if -d '../lib';
}
}
use strict;
use Test;
use SOAP::Lite
on_fault => sub {
my $soap = shift;
my $res = shift;
ref $res ? warn(join " ", "SOAP FAULT:", $res->faultstring, "\n")
: warn(join " ", "TRANSPORT ERROR:", $soap->transport->status, "\n");
return new SOAP::SOM;
}
;
my($a, $s, $r);
# updated on 2001/08/17
# http://services.xmethods.net:80/soap/servlet/rpcrouter
my $proxy = 'http://nagoya.apache.org:5049/axis/servlet/AxisServlet';
# ------------------------------------------------------
use SOAP::Test;
$s = SOAP::Lite->uri('http://something/somewhere')->proxy($proxy)->on_fault(sub{});
eval { $s->transport->timeout($SOAP::Test::TIMEOUT = $SOAP::Test::TIMEOUT) };
$r = $s->test_connection;
unless (defined $r && defined $r->envelope) {
print "1..0 # Skip: ", $s->transport->status, "\n";
exit;
}
# ------------------------------------------------------
plan tests => 15;
{
# XMethod's JavaSOAP server (http://xmethods.net/detail.html?id=11)
print "XMethod's JavaSOAP server test(s)...\n";
$s = SOAP::Lite
-> uri('http://soapinterop.org/')
-> proxy($proxy)
;
$a = 'SOAP::Lite';
$r = $s->echoString($a)->result;
ok($r eq $a);
$a = ['a', 'b'];
$r = $s->echoStringArray($a)->result;
ok(ref $r && join('', @$r) eq join('', @$a));
$a = 11;
$r = $s->echoInteger($a)->result;
ok($r == $a);
$a = [1, 3, 5];
$r = $s->echoIntegerArray($a)->result;
ok(ref $r && join('', @$r) == join('', @$a));
$a = 11.02;
$r = $s->echoFloat($a)->result;
ok($r == $a);
$a = [1.1, 3.3, 5.5];
$r = $s->echoFloatArray($a)->result;
ok(ref $r && join('', @$r) eq join('', @$a));
# you may specify URI manually (but see maptype() below)
$a = {varString => 'b', varInt => 2, varFloat => 95.7};
$r = $s->echoStruct(
SOAP::Data->type('xx:SOAPStruct' => $a)
->attr({'xmlns:xx' => 'http://soapinterop.org/xsd'})
)->result;
ok(ref $r && join('', sort values %$r) eq join('', sort values %$a));
# specify mapping to URI
$s->maptype({SOAPStruct => 'http://soapinterop.org/xsd'});
$a = {varString => 'b', varInt => 2, varFloat => 95.7};
$r = $s->echoStruct($a)->result;
ok(ref $r && join('', sort values %$r) eq join('', sort values %$a));
$a = {varString => 'b', varInt => 2, varFloat => 95.7};
$r = $s->echoStruct(SOAP::Data->name(something => $a))->result;
ok(ref $r && join('', sort values %$r) eq join('', sort values %$a));
$a = [
{varString => 'b', varInt => 2, varFloat => 95.7},
{varString => 'c', varInt => 3, varFloat => 85.7},
{varString => 'd', varInt => 4, varFloat => 75.7},
];
$r = $s->echoStructArray($a)->result;
ok(ref $r && join('', map { sort values %$_ } @$r) eq join('', map { sort values %$_ } @$a));
$a = [
{varString => 'b', varInt => 2, varFloat => 95.7},
{varString => 'c', varInt => 3, varFloat => 85.7},
{varString => 'd', varInt => 4, varFloat => 75.7},
];
$r = $s->echoStructArray(SOAP::Data->name(something => $a))->result;
ok(ref $r && join('', map { sort values %$_ } @$r) eq join('', map { sort values %$_ } @$a));
my $key = "\0\1";
my $value = 456;
{ local $^W;
# implicit, warning with -w
$a = $s->echoMap({a => 123, $key => $value})->result;
ok($a->{$key} == $value);
}
# explicit
$a = $s->echoMap(SOAP::Data->type(map => {a => 123, $key => $value}))->result;
ok($a->{$key} == $value);
{ local $^W;
# implicit, warning with -w
$a = $s->echoMapArray([{a => 123, $key => $value}, {b => 123, $key => 789}])->result;
ok($a->[0]->{$key} == $value);
}
# explicit
$a = $s->echoMapArray([SOAP::Data->type(map => {a => 123, $key => $value}), SOAP::Data->type(map => {b => 123, $key => 789})])->result;
ok($a->[0]->{$key} == $value);
}

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks