#!/usr/local/bin/perl # srs6soap.pl use lib('/Users/gilbertd/perl','/bio/perlib'); use SOAP::Lite; # +trace => debug; #+trace => transport; #+trace => qw(transport method ); use Getopt::Long; # Command line options module #my $servname= 'file:/Users/gilbertd/newstuf/xwsoap/srs6soap.wsdl'; my $servname= 'file:/c7/eugenes/ldap/srs6soap.wsdl'; my $proxy= "http://iubio.bio.indiana.edu:7180/cgi-bin/srs6soap.cgi"; my $uri= "http://iubio.bio.indiana.edu/SRS6SOAP"; # change URI namespace to analog of ldap://host/srv=srs ?? # $xmlresult= SRS6SOAP::search( $basedn, $attributes, $scope, $filter, $extensions) my %parsets= ( base => ['','','base','','sizelimit=10'], one => ['lib=locuslink','','one','','sizelimit=10'], testq1 => ['','','sub','(&(objectClass=*)(lib=locuslink refseq)(des=adh))','sizelimit=10'], testr1 => ['','','sub','(&(objectClass=BioseqRecord)(lib=locuslink refseq)(des=adh))','sizelimit=10'], # this one matches ldap test Q1-Q3 - 20073 records, 67 MB raw data q1 => ['','','sub','(&(objectClass=*)(lib=swissprot refseq trembl)(des=kinase))',''], # r3a => ['','','sub','(&(objectClass=BioseqRecord)(lib=swissprot refseq trembl)(des=kinase))',''], q3 => ['','','sub','(&(objectClass=BioseqRecord)(lib=swissprot refseq trembl)(des=kinase))'], q5 => ['','','sub','(&(objectClass=*)(lib=genbank)(org=drosophila))',''], q7 => ['','','sub','(&(objectClass=BioseqRecord)(lib=genbank)(org=drosophila))'], ); my %getzsets= ( q1 => ['[libs={locuslink refseq}-org:drosophila*]&[libs-des:adh]','-c'], q2 => ['[libs={locuslink refseq}-org:drosophila*]&[libs-des:adh]','-e -ll 10'], ); my %xdecode=('amp'=>'&', 'lt'=>'<', 'gt'=>'>'); sub xdecode { (my $e = $_[0]) =~ s/&(amp|lt|gt);/$xdecode{$1}/eg; $e } my ($base,$attr,$scope,$filt,$ext); my $dopage= 1; my $pagesize= 2000; my $maxresult= 9999999; my $timeout=500; my $query; Getopt::Long::GetOptions( 'query=s' => \$query, ); #@qset= join(", ", sort keys %parsets); my $qs; foreach my $k (sort keys %parsets) { ($base,$attr,$scope,$filt,$ext)= @ {$parsets{$k}}; $qs .= "$k => $base, $scope, $filt\n"; } die < service($servname); $service->proxy('http://fake/', timeout => $timeout, # seconds ? # options => { compress_threshold => 10240 } ); if ($dopage) { pagedSearch($service,$pagesize,$maxresult,$base,$attr,$scope,$filt,$ext); } else { print "srs6soap service. search($base,$attr,$scope,$filt,$ext)=\n"; my $result= $service->search($base,$attr,$scope,$filt,$ext); if ($result) { print xdecode($result); } else { print "No result received - server possibly down.\n"; print "Exact errors: " . $service->call->faultcode . ":" . $service->call->faultstring; } } print "\n-----\n"; exit; #--------------- my($getzq,$getzp)= @ {$getzsets{q2}}; print "srs6soap service. getz($getzq,$getzp)=\n"; my $result= $service->getz($getzq,$getzp); if ($result) { print xdecode($result); } else { print "No result received - server possibly down.\n"; print "Exact errors: " . $service->call->faultcode . ":" . $service->call->faultstring; } print "__END__\n\n"; # soap dies out of mem w/ 1000s of data records ! #Exact errors: SOAP-ENV:Client:Out of memory during "large" request for 134221824 byte #s, total sbrk() is 2034454472 bytes at /export/home/gilbertd/perl/SOAP/Lite.pm line 1109. # try paging results - need query count (?) 1st sub pagedSearch { my($service,$pagesize,$maxresult,$base,$attr,$scope,$filt,$ext)=@_; print "# srs6soap service. pagedSearch($base,$attr,$scope,$filt,$ext)=\n"; my $start= 0; $pagesize ||= 1000; #? $maxresult ||= 9999999; while ($start < $maxresult) { my $pagefilt= $filt; $pagefilt =~ s/\(objectClass/(start=$start)(count=$pagesize)(objectClass/i; print "# pagedSearch = $start,$pagesize,$pagefilt \n"; my $result= $service->search($base,$attr,$scope,$pagefilt,$ext); if ($result) { print xdecode($result); } else { print "No result received - server possibly down.\n"; print "Exact errors: " . $service->call->faultcode . ":" . $service->call->faultstring; return; } $start += $pagesize; } } __END__ ## srs6 SOAP service test (soap.cgi system call to srs6ldap2.cc) r2 => ['','','sub', '(&(objectClass=BioseqRecord)(lib=swissprot refseq trembl)(des=kinase))',''], oat.% /usr/bin/time ./srs6soap.pl > ! tout.soap real 4:21.8 user 0.7 sys 0.1 No result received - server possibly down. Exact errors: SOAP-ENV:Client:Out of memory during "large" request for 134221824 byte s, total sbrk() is 2034454472 bytes at /export/home/gilbertd/perl/SOAP/Lite.pm line 1 109. ^^^ no good to fetch all as one result/object - need to have cli/serv step thru list of results, fetching one at a time ? does soap offer any paging methods for transport ?? ## need soap->proxy('http://localhost/', timeout => 500); oat.% /usr/bin/time ./srs6soap.pl > ! tout.soap 500 read timeout at ./srs6soap.pl line 54 real 3:00.8 user 0.7 sys 0.1 my %dests = ( CGI => ['http://localhost/~gilbertd/cgi-bin/soapin/temp.cgi' => 'http://localhost/Temperatures'], daemon => ['http://localhost:81/' => 'http://localhost/Temperatures'], ); my $servname= 'file:/Users/gilbertd/newstuf/xwsoap/tempur.wsdl'; my($proxy, $uri) = @{$dests{'CGI'}}; print "\nsoap 1. c2f(37.5)=",SOAP::Lite -> uri($uri) -> proxy($proxy) -> c2f(37.5) -> result,"\n";