[MOBY-guts] biomoby commit
Mark Wilkinson
mwilkinson at dev.open-bio.org
Tue Feb 6 21:46:12 UTC 2007
mwilkinson
Tue Feb 6 16:46:12 EST 2007
Update of /home/repository/moby/moby-live/Perl/MOBY/Client
In directory dev.open-bio.org:/tmp/cvs-serv19443/MOBY/Client
Modified Files:
Service.pm
Log Message:
Asynchronous services will not necessarily report the correct serviceName in the old code due to undefined Perl hash orders, so we have to explicitly extract it. Added a new method 'methods' that will retrieve all of the method calls for an Asynchronous service
moby-live/Perl/MOBY/Client Service.pm,1.31,1.32
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm 2007/02/06 02:53:11 1.31
+++ /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm 2007/02/06 21:46:12 1.32
@@ -129,9 +129,10 @@
my $soap = SOAP::Lite->service( "data:,$wsdl" );
$soap->soapversion('1.1');
- if ( $self->uri ) { $soap->uri( $self->uri ) }
- $self->serviceName( &_getServiceName( $soap ) );
$self->_soapService( $soap );
+ if ( $self->uri ) { $soap->uri( $self->uri ) }
+ $self->serviceName( $self->_getServiceName() );
+ return undef unless $self->serviceName; # servicename could not be determined, so no methods can be called
return $self;
}
@@ -336,6 +337,22 @@
return $result;
}
+=head2 methods
+
+ Usage : $name = $Service->methods()
+ Function : Internal method to retrieve all methods from a service
+ Returns : listref of method names as strings
+ Args : none
+
+=cut
+
+sub methods {
+ my ($self) = @_;
+ my $service = $self->_soapService;
+ no strict;
+ my @methods = @{ join '::', ref $service, 'EXPORT_OK' };
+ return \@methods
+}
=head2 serviceName
@@ -351,18 +368,27 @@
Usage : $name = $Service->_getServiceName()
Function : Internal method to retrieve the name of the service from the SOAP object
+ In the case of Asynchronous services it will return the base name of
+ the service (i.e. myService, rather than myService_submit). This base name
+ is not guaranteed to give you any output if you call it!
Returns : string
Args : none
=cut
sub _getServiceName {
- my ( $service ) = @_;
- no strict;
- my ( $method ) = @{ join '::', ref $service, 'EXPORT_OK' };
- return $method;
+ my ( $self ) = @_;
+ my @methods = @{$self->methods};
+ return shift @methods if scalar @methods <=1; # in case of non-asynch services it is the only one there.
+ foreach (@methods){
+ next unless m/^(\S+)_submit/;
+ return $1;
+ }
+ return undef
}
+
+
sub AUTOLOAD {
no strict "refs";
my ( $self, $newval ) = @_;
More information about the MOBY-guts
mailing list