#!/usr/bin/env perl use SOAP::Lite; use Data::Dumper; use Getopt::Long; #production system $wsdlurl = "http://bibiserv.techfak.uni-bielefeld.de/wsdl/RNAshapes.wsdl"; #test system #$wsdlurl = "http://bibitest.techfak.uni-bielefeld.de/wsdl/RNAshapes.wsdl"; my $mode = "a"; my $shape = 5; my $energy = -1; my $energy_mode = ""; my $prob_number = -1; my $prob_cutoff = -1; my $prob_output = -1; my $sampling = -1; my $calc_struc_prob; my $ignore_unstable; my $match_shape = ""; my $window_incr = -1; my $window_size = -1; my $sequencefile = ""; my $email=""; GetOptions("mode=s" => \$mode, #char "shape=i" => \$shape, #int "energy=i" => \$energy, #double "energy_mode=s" => \$energy_mode, #char "prob_number=i" => \$prob_number, #int "prob_cutoff=f" => \$prob_cutoff, #double "prob_output=f" => \$prob_output, #double "sampling=i" => \$sampling, #int "calc_struct_prob" => \$calc_struct_prob, #boolean "ignore_unstable" => \$ignore_unstable, #boolean "match_shape=s" => \$match_shape, #String "window_size=i" => \$window_size, #int "window_incr=i" => \$window_incr, #int "sequencefile=s" => \$sequencefile, #file "email=s" => \$email #String ); if($sequencefile eq ""){ print "At least sequencefile must be given! (-sequencefile )"; exit 1; } my $sequence = readFile($sequencefile); my @params = ("mode", SOAP::Data->type(string => $mode), "shape", SOAP::Data->type(int => $shape)); if(($energy!=-1)&&($energy_mode ne "")){ @params = (@params, "energy_mode", SOAP::Data->type(string => $energy_mode), "energy", SOAP::Data->type(double => $energy)); } if($prob_number!=-1){ @params = (@params, "prob_number", SOAP::Data->type(int => $prob_number)); } if($prob_cutoff!=-1){ @params = (@params, "prob_cutoff", SOAP::Data->type(double => $prob_cutoff)); } if($prob_output!=-1){ @params = (@params, "prob_output", SOAP::Data->type(double => $prob_output)); } if($sampling!=-1){ @params = (@params, "sampling", SOAP::Data->type(int => $sampling)); } if($calc_struct_prob){ @params = (@params, "calc_struct_prob", SOAP::Data->type(boolean => $calc_struct_prob)); } if($ignore_unstable){ @params = (@params, "ignore_unstable", SOAP::Data->type(boolean => $ignore_unstable)); } if($match_shape ne ""){ @params =(@params, "match_shape", SOAP::Data->type(string => $match_shape)); } if($window_size!=-1){ @params =(@params, "window_size", SOAP::Data->type(int => $window_size)); } if($window_incr!=-1){ @params =(@params, "window_incr", SOAP::Data->type(int => $window_incr)); } print "Submitting your request ...\n"; $result = SOAP::Lite->service($wsdlurl) ->on_fault(sub {soapFaultHandler(@_)}) ->request_orig($email, $sequence, \@params); print "got id: '$result'\n"; sub soapFaultHandler { print "\n Error:\n"; my($soap, $res) = @_; if (ref $res) { print "Statuscode:".$res->faultcode."\n"; print "Description:".$res->faultstring."\n"; $detail = $res->faultdetail; if(defined($detail->{"hobitStatuscode"})) { print Dumper $detail->{"hobitStatuscode"}->{"statuscode"}; print Dumper $detail->{"hobitStatuscode"}->{"description"}; } else { print "Sevlet Error - no Hobit Statuscode\n"; } } else { print "http layer Error: "; print $soap->transport->status; } exit 1; } sub readFile{ my $file = shift; my $content = ""; open(FILE, $file) or die("Cannot open file $file !"); foreach my $line (){ $content .= $line; } close FILE; return $content; }