[MOBY-l] clarification of some Java issues
Martin Senger
senger at ebi.ac.uk
Thu Nov 20 19:02:05 UTC 2003
Recently I have got several questions regarding using Java in BioMoby. The
questions indicated some confusion - let me please try to explain it here
- later I will update the jMoby documentation to reflect the same there.
At the moment, Java in the BioMoby project is used only for accessing
Moby Central registry. There are two ways how to access the registry using
Java:
a) You can use ready clients. For that you do not need to write your
own Java programs - just call the available clients to get the contents of
the registry, or to register new items in the registry. The main client
doing this can be invoked by 'run-cmdline-client' script. There is a long
help for this client explaining what you can do (everything is done from
the command-line).
b) Or you can write your own program by using class CentralImpl that
takes care about putting your requests into proper XML pieces and calls
the registry. The API for this class in called Central.java and should be
available from the main BioMoby web site (there were some issues with it -
but Mark took care about it and all links will soon be available -
meanwhile you may use my mirror -
http://industry.ebi.ac.uk/~senger/jMoby/API/index.html).
Notice that both methods above are used to access BioMoby registry, NOT
THE INDIVIDUAL SERVICES. I am working on another API which will hopefully
help to call services but this API does not exist yet.
However - and here is why the confusion appeared - the interface
Central.java has also a method 'call' that can send any data to any
method. The method does not help with the XML (you have to know what XML
to send, and you get back again an XML without any support) but it helps
you with the SOAP itself (you do not need to kniow how to create a SOAP
request).
Because of this partially support, some users started to use this
'call' method also for calling services. It is possible, but there were,
however, two issues with such usage:
a) It is necessary to say that you are not calling a service, and not
the biomoby registry. This can be done by supplying proper endpoint and
namespace in the constructor. For example, you may use in yourt program:
Central central = new CentralImpl (
"http://mobycentral.cbr.nrc.ca/cgi-bin/Services/Services.cgi",
"http://biomoby.org/"
);
(Mark, this was in the example code that Yasumasa Shigemoto showed in his
email - so he was really calling the service, not the registry. His
problem was somewhere else - see below - but not here.)
b) As we found during the last I3C hackathon, in order to make the
Perl-based service happy, it is necessary to set SOAPAction header. The
CentralImpl did not do it. It does not matter when you call the biomoby
registry (from the reasons I have already forgotten, perhaps Mark
remembers them) but it matters when you call other services (without this
header you usually receive "access denied" error message).
Today, I have fixed this. I have added SOAPAction header to the
CentralImpl.
After this fix, the CentralImpl actually can be used for calling
services. But as I said you do not have any support for dealing with the
input and output XML. I consider this usage a "quick-and-dirty" way - and
I hope to come soon with more practical solution (similar to what
Marks's CommonSubs does for the Perl users).
Regards,
Martin
--
Martin Senger
EMBL Outstation - Hinxton Senger at EBI.ac.uk
European Bioinformatics Institute Phone: (+44) 1223 494636
Wellcome Trust Genome Campus (Switchboard: 494444)
Hinxton Fax : (+44) 1223 494468
Cambridge CB10 1SD
United Kingdom http://industry.ebi.ac.uk/~senger
More information about the moby-l
mailing list