#!/bin/env perl
# Usage: absquery-client.pl key=value [...]

use SOAP::Lite; 
use XML::Simple;
my $debug = (@ARGV and $ARGV[0] eq '--debug') ? shift(@ARGV) : 0;
my %query = map { split(/=/,$_,2) } @ARGV;

SOAP::Trace->import('all') if ($debug);

my $response = SOAP::Lite
    -> uri('http://ads.harvard.edu/AbsQuery')
    -> proxy('http://ads.harvard.edu/ws/bibserver')
    -> query(%query);

die $response->faultcode, ', ', $response->faultstring if ($response->fault);
print XMLout($response->result, noattr => 1);
