2 # Query the DB0SDX QSL server for a callsign
4 # Copyright (c) 2003 Dirk Koopman G1TLH
9 my ($self, $line) = @_;
10 my $call = $self->call;
14 return (1, $self->msg('e24')) unless $Internet::allow;
15 return (1, "SHOW/DB0SDX <callsign>, e.g. SH/DB0SDX ea7wa") unless $line && is_callsign($line);
16 my $target = 'dotnet.grossmann.com';
18 my $cmdprompt = '/query->.*$/';
24 dbg("db0sdx: contacting $target:$port") if isdbg('db0sdx');
25 $info = $t->open(Host => $target,
30 push @out, $self->msg('e18', 'DB0SDX Database server');
33 dbg("db0sdx: connected to $target:$port") if isdbg('db0sdx');
35 my $s = qq(<?xml version="1.0" encoding="utf-8"?>
36 <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
38 <qslinfo xmlns="http://dotnet.grossmann.com/qslinfo">
39 <callsign>$line</callsign>
46 my $lth = length($s)+7;
48 dbg("db0sdx out: $s") if isdbg('db0sdx');
50 $t->print("POST /qslinfo/qslinfo.asmx HTTP/1.0");
51 $t->print("Host: dotnet.grossmann.com");
52 $t->print("Content-Type: text/xml; charset=utf-8");
53 $t->print("Content-Length: $lth");
54 $t->print("Connection: Close");
55 $t->print("SOAPAction: \"http://dotnet.grossmann.com/qslinfo/qslinfo\"");
61 while (my $result = eval { $t->getline(Timeout => 30) } || $@) {
63 push @out, $self->msg('e18', 'DB0SDX Server');
70 dbg("db0sdx in: $in") if isdbg('db0sdx');
73 Log('call', "$call: show/db0sdx $line");
76 my ($info) = $in =~ m|<qslinfoResult>([^<]*)</qslinfoResult>|;
77 my @in = split /[\r\n]/, $info if $info;
81 ($info) = $in =~ m|<faultstring>([^<]*)</faultstring>|;
82 push @out, $info if $info;
83 push @out, $self->msg('e3', 'DB0SDX', $line) unless @out;