[MOBY-l] REST Service registration

Rajasekar Karthik karthik085 at gmail.com
Tue May 1 15:41:09 UTC 2007


Ok. Thanks. I will try this way too.

On 5/1/07, Paul Gordon <gordonp at ucalgary.ca> wrote:
>
>  Or alternatively, you could use the MobyServlet framework
>
>
> http://biomoby.open-bio.org/CVS_CONTENT/moby-live/Java/docs/deployingServices.html
>
> In which case your code would be (I haven't compoiled this, but you get
> the point):
>
> import org.biomoby.shared.MobyDataType;
> import org.biomoby.shared.data.*;
> import org.biomoby.service.*;
> import java.io.*;
>
> // Annotation describing the service semantics
> @mobyService(name="YourServiceName",
>              type="AppropriateServiceType",
> 	     provider="auth.site.com",
> 	     author="foo at site.com" <foo at site.com>,
> 	     in={"inputString:String"},
> 	     out={"outputHTML:text-html"},
> 	     description={"Executes service X by wrapping a REST session"})
>
> public class YourClass extends MobyServlet{
>     public static final String BASE_URL = "http://site.com/Service?Parameter1=" <http://site.com/Service?Parameter1=>;
>     public void processRequest(MobyDataJob request, MobyDataJob result) throws Exception{
>          // The input parameter matches that specified in the mobyService annotation above
>          MobyDataString inputParam = (MobyDataString) request.get("inputString");
>
>
>          URL restURL = new URL(BASE_URL+inputParam);
>          StringBuffer htmlBuffer = new StringBuffer();
>          LineNumberReader r = new LineNumberReader(new InputStreamReader(
> url.openStream()));
>          for(String line = r.readLine(); line != null; line = r.readLine
> ()){
>              htmlBuffer.append(line);
>          }
>
>          // Create the results (text-html matches mobyService annotation
> declaration)
>          MobyDataComposite htmlObject = new MobyDataComposite(
> MobyDataType.getDataType("text-html"), null , null, htmlBuffer.toString
> ());
>
>
>          // Set the result that will be passed back to the client (same name as in mobyService annotation above)
>          result.put("outputHTML", htmlObject);
>
>        }
> }
>
> Are you planning on coding in perl or java?
>
>
>
> First, register the service using whatever method you wish (I use
> Dashboard).
>
>
>
> Second, create the code for the service;
>
>
>
> If you are using JAVA,
> http://biomoby.open-bio.org/CVS_CONTENT/moby-live/Java/docs/ has information
> for you (under Developing jMoby services)
>
>
>
> If you are using Perl,
> http://biomoby.open-bio.org/CVS_CONTENT/moby-live/Java/docs/PerlMoses.html
> explains how to create the service.
>
>
>
> I would develop a hello world service that takes in a string and returns
> whatever you wish. Once you get that working, the rest would be trivial
> because all you would have to do instead of returning hello world is invoke
> your rest service and return the response.
>
>
>
> If you need further guidance, let me know. I am unsure of how much you know!
>
>
>
> Thanks,
>
>
>
> Eddie
>
>   _____
>
> From: Rajasekar Karthik [mailto:karthik085 at gmail.com <karthik085 at gmail.com>]
> Sent: Tuesday, May 01, 2007 7:36 AM
> To: Edward Kawas
> Cc: moby-l at biomoby.org
> Subject: Re: [MOBY-l] REST Service registration
>
>
>
> Eddie,
>
> On 5/1/07, Edward Kawas <edward.kawas at gmail.com> <edward.kawas at gmail.com> wrote:
>
> Hi,
>
> That wouldn't be right (w.r.t. to moby).
>
> Personally, I think that you will have to wrap this REST service in a moby
> service.
>
>
> This is what I am trying to do. Sorry, I should have explained it clearer.
>
> But, how do I do this? I already have a REST service that takes a string
> name as input. Can you explain in detail?
>
>
>
> So, you would create a web service that takes a string name as
> input.
>
> This web service would then pass on the string to
> http://site.com/Service?Parameter1=INPUT_STRING, obtain a result and send it
> back to the caller of the moby service.
>
> The reason that I think that you are incorrect, is because moby has a
> predefined message structure that you will have follow to be compatible.
>
> Hope this makes sense!
>
> Eddie
>
>
>    -----Original Message-----
> From: moby-l-bounces at lists.open-bio.org [mailto:moby-l-bounces at lists.open <moby-l-bounces at lists.open>-
> bio.org] On Behalf Of Rajasekar Karthik
> Sent: Tuesday, May 01, 2007 7:16 AM
> To: moby-l at biomoby.org
> Subject: [MOBY-l] REST Service registration
>
> Hi,
>
> I am trying to register a new service. In Service Endpoint - URL, I want
> to
> store the URL to REST service.
>
> URL is something like:http://site.com/Service?Parameter1=Value1
>
> Site: site.com
> Service: Service
> Parameter1: parameter/name
> Value1: value for the parameter1
>
> eg:http://mysite.com/Analysis?Name=phob
> http://mysite.com/Analysis?Name=lac
>
> In order to register the service, I have to input:
> - in the Service Endpoint - URL: http://mysite.com/Analysis?
> - in the input data, add
>    a) Name (String)
>
> Is this right? If not, how can I register the service?
>
> --
> Best Regards,
> Rajasekar Karthik
> karthik085 at gmail.com
> _______________________________________________
> moby-l mailing list
> moby-l at lists.open-bio.org  <mailto:moby-l at lists.open-bio.org> <moby-l at lists.open-bio.org>
> http://lists.open-bio.org/mailman/listinfo/moby-l
>
>
>
>
>


-- 
Best Regards,
Rajasekar Karthik
karthik085 at gmail.com



More information about the moby-l mailing list