Moby Central API (was Re: [MOBY-l] service = method ?)

Mark Wilkinson mwilkinson at gene.pbi.nrc.ca
Fri Oct 25 14:23:43 UTC 2002


Hi Martin!

>    The problem with the new() method is not that it exists but that the
> returned data type (a Moby Central object) is not well defined in the
> documented API. The Perl code says it, however, clearly - the returned
> object is a hashtable (as usual for Perl objects), and as such it is easy
> to use it in (for example) Java clients.

this is good news!  I hadn't clearly understood at what point you were 
encountering problems.


>    The knowledge of the data type returned by the new() method is needed 
> for any other method call because their first parameter is always the Moby 
> Central object (am I right here, Mark?).

yes... in fact, in the code it is even more explicit than it might be 
because I am not using +autodispatch (a bug in Perl 5.8 precludes that). 
  If I had used autodispatch it would not have been as obvious since 
autodispatch does this automagically (as far as I can tell...).


>    So it seems to me that the existence of the new() method is not only 
> that it "looks prettier", but that it allows to keep a session state. In 
> other words, the new() method returns a "handler" which is later used by 
> the same user - so the handler can (if the implementation needs and wants 
> it) recognize that the same user is coming back.

Right.  It is potentially useful, but we don't really use it at the 
moment and it could be removed with only minor code changes... in fact, 
the only time I use "self" at the moment is to make the database 
connection, where $self contains the path to the database configuration 
file, so it could **easily** be removed if this makes life easier for 
everyone.


>    Was this behaviour wanted or was it just "a lucky side-effect"?

A bit of both ;-)  It ended up this way because SOAP::Lite in "OO mode" 
tries to mimik typical Perl OO behaviour and (I suppose not 
surprisingly) requires that the current object be explicitly passed to 
the subroutine call as the first parameter so that it can operate on it 
if it needs to.  I was quite bemused by the whole thing at the 
beginning, to be honest, because my first experiences with SOAP were not 
OO, but then I got used to it and completely forgot that it might cause 
problems for others.


>    Summary:
>    1) If the "session behaviour" is wanted, there is no need to change the
> interface - and I can send a WSDL of Moby Central at once, The only change
> would go to API documentation saying that the returned data type of the
> new() method is a hashtable.
>    2) Else, let's change the API so that:
>       - the new() method is removed, and
>       - the first parameter of all other methods is removed.
>       Then again I can create and send it a WSDL.

I think that the session state information has the potential to be 
useful in the future.  If it is not problematic (so long as it is 
properly and fully described in the documentation) then let's leave it 
in for now.

Note that the registration object is also a very simple hashtable...

Thanks very much for writing the WSDL!  That will really help lower the 
bar for all future users.  What tool are you using to write the WSDL?

Best wishes!

M

-- 
--------------------------------
"Speed is subsittute fo accurancy."
________________________________

Dr. Mark Wilkinson, RA Bioinformatics
National Research Council, Plant Biotechnology Institute
110 Gymnasium Place, Saskatoon, SK, Canada

phone : (306) 975 5279
pager : (306) 934 2322
mobile: markw_mobile at illuminae.com





More information about the moby-l mailing list