1#!/bin/env perl 
2
3BEGIN {
4  unless(grep /blib/, @INC) {
5    chdir 't' if -d 't';
6    unshift @INC, '../lib' if -d '../lib';
7  }
8}
9
10use strict;
11use Test;
12
13use SOAP::Lite
14  on_fault => sub {
15    my $soap = shift;
16    my $res = shift;
17    ref $res ? warn(join "\n", "--- SOAP FAULT ---", $res->faultcode, $res->faultstring, '') 
18             : warn(join "\n", "--- TRANSPORT ERROR ---", $soap->transport->status, '');
19    return new SOAP::SOM;
20  }
21;
22
23my($a, $s, $r, $serialized, $deserialized);
24
25my $proxy = 'http://localhost:8080/soap/servlet/rpcrouter';
26
27# ------------------------------------------------------
28use SOAP::Test;
29
30$s = SOAP::Lite->uri('http://something/somewhere')->proxy($proxy)->on_fault(sub{});
31eval { $s->transport->timeout($SOAP::Test::TIMEOUT = $SOAP::Test::TIMEOUT) };
32$r = $s->test_connection;
33
34unless (defined $r && defined $r->envelope) {
35  print "1..0 # Skip: ", $s->transport->status, "\n"; 
36  exit;
37}
38# ------------------------------------------------------
39
40plan tests => 2;
41
42{
43# Local server with Apache SOAP (http://xml.apache.org/soap)
44  print "Apache SOAP server test(s)...\n";
45  $s = SOAP::Lite 
46    -> uri('urn:xmltoday-delayed-quotes')
47    -> proxy($proxy)
48  ;
49
50  ok($s->getQuote('MSFT')->result > 0);
51  ok($s->getQuote(SOAP::Data->name(symbol => 'MSFT'))->result > 0);
52}
53