| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package WebService::FuncNet; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 2 |  |  | 2 |  | 24442 | use warnings; | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 65 |  | 
| 4 | 2 |  |  | 2 |  | 10 | use strict; | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 54 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 2 |  |  | 2 |  | 2152 | use Data::Dumper; | 
|  | 2 |  |  |  |  | 15743 |  | 
|  | 2 |  |  |  |  | 134 |  | 
| 7 | 2 |  |  | 2 |  | 1936 | use LWP::UserAgent; | 
|  | 2 |  |  |  |  | 92289 |  | 
|  | 2 |  |  |  |  | 59 |  | 
| 8 | 2 |  |  | 2 |  | 17 | use Carp; | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 138 |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 | 2 |  |  | 2 |  | 985 | use XML::Compile::WSDL11; | 
|  | 0 |  |  |  |  |  |  | 
|  | 0 |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | use XML::Compile::SOAP11; | 
| 12 |  |  |  |  |  |  | use XML::Compile::Transport::SOAPHTTP; | 
| 13 |  |  |  |  |  |  | use XML::Compile::Schema; | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | our $VERSION = '0.2'; | 
| 16 |  |  |  |  |  |  | our $WSDL_URL = 'http://funcnet.eu/soap/FrontEnd.wsdl'; | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | =head1 NAME | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | WebService::FuncNet - Wrapper around the FuncNet web services | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | FuncNet is an open platform for the prediction and comparison of human protein | 
| 25 |  |  |  |  |  |  | function. It is funded funded by the European Union’s EMBRACE Network of Excellence, | 
| 26 |  |  |  |  |  |  | and developed in partnership with the ENFIN project. | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | For more information, you can visit http://funcnet.eu/ | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | my $ra_ref_proteins   = [ 'A3EXL0','Q8NFN7', 'O75865' ]; | 
| 31 |  |  |  |  |  |  | my $ra_query_proteins = [ 'Q9H8H3','Q5SR05','P22676' ]; | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | my $r = WebService::FuncNet::Request->new( | 
| 34 |  |  |  |  |  |  | $ra_ref_proteins, | 
| 35 |  |  |  |  |  |  | $ra_query_proteins, | 
| 36 |  |  |  |  |  |  | 'test@example.com' ); | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | ## | 
| 39 |  |  |  |  |  |  | ## returns a WebService::FuncNet::Job object | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | my $j = $r->submit( ); | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | my $status = $j->status(); | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | if ( $status ) { | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | ## | 
| 48 |  |  |  |  |  |  | ## returns a WebService::FuncNet::Results object | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | my $r = $j->results; | 
| 51 |  |  |  |  |  |  | print $r->as_xml; | 
| 52 |  |  |  |  |  |  | } | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | =head1 FUNCTIONS | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | =head2 init | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | Internal function used to fetch the FuncNet frontend WSDL file. | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | Do not use directly. | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | =cut | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | sub init { | 
| 65 |  |  |  |  |  |  | my $class = shift; | 
| 66 |  |  |  |  |  |  | my $ua    = LWP::UserAgent->new(); | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | my $rh_compiled_clients = { }; | 
| 69 |  |  |  |  |  |  | my $wsdlfile; | 
| 70 |  |  |  |  |  |  |  | 
| 71 |  |  |  |  |  |  | my $response = | 
| 72 |  |  |  |  |  |  | $ua->get( $WSDL_URL ); | 
| 73 |  |  |  |  |  |  |  | 
| 74 |  |  |  |  |  |  | if ( $response->is_success ) { | 
| 75 |  |  |  |  |  |  | $wsdlfile = $response->decoded_content; | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | my $WSDL = | 
| 78 |  |  |  |  |  |  | XML::Compile::WSDL11->new( $wsdlfile ); | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  | unless ( $WSDL ) { | 
| 81 |  |  |  |  |  |  | carp "Could not create WSDL object with fetched data."; | 
| 82 |  |  |  |  |  |  | die; | 
| 83 |  |  |  |  |  |  | } | 
| 84 |  |  |  |  |  |  |  | 
| 85 |  |  |  |  |  |  | my @op_defs = $WSDL->operations(); | 
| 86 |  |  |  |  |  |  |  | 
| 87 |  |  |  |  |  |  | foreach my $op ( @op_defs ) { | 
| 88 |  |  |  |  |  |  | my $name = $op->{name}; | 
| 89 |  |  |  |  |  |  | my $op = $WSDL->operation( operation => $name ); | 
| 90 |  |  |  |  |  |  | $rh_compiled_clients->{ $name } = $op->compileClient(); | 
| 91 |  |  |  |  |  |  | } | 
| 92 |  |  |  |  |  |  |  | 
| 93 |  |  |  |  |  |  | return $rh_compiled_clients; | 
| 94 |  |  |  |  |  |  | } | 
| 95 |  |  |  |  |  |  |  | 
| 96 |  |  |  |  |  |  | else { | 
| 97 |  |  |  |  |  |  | carp "Unable to fetch WSDL. Tried $WSDL_URL and it returned ", | 
| 98 |  |  |  |  |  |  | $response->status_line; | 
| 99 |  |  |  |  |  |  | die; | 
| 100 |  |  |  |  |  |  | } | 
| 101 |  |  |  |  |  |  | } | 
| 102 |  |  |  |  |  |  |  | 
| 103 |  |  |  |  |  |  | =head1 AUTHOR | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  | Spiros Denaxas, C<<  >> | 
| 106 |  |  |  |  |  |  |  | 
| 107 |  |  |  |  |  |  | =head1 BUGS | 
| 108 |  |  |  |  |  |  |  | 
| 109 |  |  |  |  |  |  | Please report any bugs or feature requests to C, or through | 
| 110 |  |  |  |  |  |  | the web interface at L.  I will be notified, and then you'll | 
| 111 |  |  |  |  |  |  | automatically be notified of progress on your bug as I make changes. | 
| 112 |  |  |  |  |  |  |  | 
| 113 |  |  |  |  |  |  | =head1 SUPPORT | 
| 114 |  |  |  |  |  |  |  | 
| 115 |  |  |  |  |  |  | You can find documentation for this module with the perldoc command. | 
| 116 |  |  |  |  |  |  |  | 
| 117 |  |  |  |  |  |  | perldoc WebService::FuncNet | 
| 118 |  |  |  |  |  |  |  | 
| 119 |  |  |  |  |  |  | You can also look for information at: | 
| 120 |  |  |  |  |  |  |  | 
| 121 |  |  |  |  |  |  | =over 4 | 
| 122 |  |  |  |  |  |  |  | 
| 123 |  |  |  |  |  |  | =item * RT: CPAN's request tracker | 
| 124 |  |  |  |  |  |  |  | 
| 125 |  |  |  |  |  |  | L | 
| 126 |  |  |  |  |  |  |  | 
| 127 |  |  |  |  |  |  | =item * AnnoCPAN: Annotated CPAN documentation | 
| 128 |  |  |  |  |  |  |  | 
| 129 |  |  |  |  |  |  | L | 
| 130 |  |  |  |  |  |  |  | 
| 131 |  |  |  |  |  |  | =item * CPAN Ratings | 
| 132 |  |  |  |  |  |  |  | 
| 133 |  |  |  |  |  |  | L | 
| 134 |  |  |  |  |  |  |  | 
| 135 |  |  |  |  |  |  | =item * Search CPAN | 
| 136 |  |  |  |  |  |  |  | 
| 137 |  |  |  |  |  |  | L | 
| 138 |  |  |  |  |  |  |  | 
| 139 |  |  |  |  |  |  | =back | 
| 140 |  |  |  |  |  |  |  | 
| 141 |  |  |  |  |  |  | =head1 ACKNOWLEDGEMENTS | 
| 142 |  |  |  |  |  |  |  | 
| 143 |  |  |  |  |  |  | A I thank you to Andrew Clegg and Ian Sillitoe. | 
| 144 |  |  |  |  |  |  |  | 
| 145 |  |  |  |  |  |  | =head1 COPYRIGHT & LICENSE | 
| 146 |  |  |  |  |  |  |  | 
| 147 |  |  |  |  |  |  | Copyright 2009 Spiros Denaxas, all rights reserved. | 
| 148 |  |  |  |  |  |  |  | 
| 149 |  |  |  |  |  |  | This program is free software; you can redistribute it and/or modify it | 
| 150 |  |  |  |  |  |  | under the same terms as Perl itself. | 
| 151 |  |  |  |  |  |  |  | 
| 152 |  |  |  |  |  |  | =head1 REVISION INFO | 
| 153 |  |  |  |  |  |  |  | 
| 154 |  |  |  |  |  |  | Revision:      $Rev: 64 $ | 
| 155 |  |  |  |  |  |  | Last editor:   $Author: andrew_b_clegg $ | 
| 156 |  |  |  |  |  |  | Last updated:  $Date: 2009-07-06 16:12:20 +0100 (Mon, 06 Jul 2009) $ | 
| 157 |  |  |  |  |  |  |  | 
| 158 |  |  |  |  |  |  | The latest source code for this project can be checked out from: | 
| 159 |  |  |  |  |  |  |  | 
| 160 |  |  |  |  |  |  | https://funcnet.svn.sf.net/svnroot/funcnet/trunk | 
| 161 |  |  |  |  |  |  |  | 
| 162 |  |  |  |  |  |  | =cut | 
| 163 |  |  |  |  |  |  |  | 
| 164 |  |  |  |  |  |  |  | 
| 165 |  |  |  |  |  |  | 1; # End of WebService::FuncNet |