2 # Query the DB0SDX QSL server for a callsign
4 # Copyright (c) 2003 Dirk Koopman G1TLH
5 # Modified Dec 9, 2004 for new website and xml schema by David Spoelstra N9KT
6 # and tidied up by me (Dirk)
17 $conn->{sdxin} .= $conn->{msg}; # because there will be stuff left in the rx buffer because it isn't \n terminated
18 dbg("db0sdx in: $conn->{sdxin}") if isdbg('db0sdx');
20 my ($info) = $conn->{sdxin} =~ m|<qslinfoResult>([^<]*)</qslinfoResult>|;
23 my @in = split /[\r\n]/, $info if $info;
29 ($info) = $conn->{sdxin} =~ m|<faultstring>([^<]*)</faultstring>|;
30 push @out, $info if $info;
31 push @out, $dxchan->msg('e3', 'DB0SDX', $conn->{sdxline}) unless @out;
41 $conn->{sdxin} .= "$msg\n";
43 dbg("db0sdx in: $conn->{sdxin}") if isdbg('db0sdx');
48 my ($self, $line) = @_;
49 my $call = $self->call;
53 return (1, $self->msg('e24')) unless $Internet::allow;
54 return (1, "SHOW/DB0SDX <callsign>, e.g. SH/DB0SDX ea7wa") unless $line && is_callsign($line);
55 my $target = $Internet::db0sdx_url || 'www.qslinfo.de';
56 my $path = $Internet::db0sdx_path || '/qslinfo';
57 my $suffix = $Internet::db0sdx_suffix || '.asmx';
60 dbg("db0sdx: contacting $target:$port") if isdbg('db0sdx');
62 my $s = qq(<?xml version="1.0" encoding="utf-8"?>
63 <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/">
65 <qslinfo xmlns="http://$target">
66 <callsign>$line</callsign>
67 <ClientInformation>DXSpider V$main::version B$main::build ($call\@$main::mycall)</ClientInformation>
71 my $lth = length($s)+1;
73 Log('call', "$call: show/db0sdx $line");
74 my $conn = AsyncMsg->post($self, $target, $port, "$path$suffix", prefix => 'sdx> ', filter => \&process,
75 'Content-Type' => 'text/xml; charset=utf-8',
76 'Content-Length' => $lth,
77 Connection => 'Close',
78 SOAPAction => qq{"http://$target$path"},
80 on_disc => \&on_disc);
83 $conn->{sdxcall} = $line;
84 push @out, $self->msg('m21', "show/db0sdx");
86 push @out, $self->msg('e18', 'DB0SDX Database server');