• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Restful WebService without annatations in eclipse using java

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We are creating an application in android which will invoke Restful webservices.But here the problem is the web services should of without annatations as we are going to deploy them in RAD(Rational Application Developer),which is not going to recognise the annatations as it is IBM specific.So We need Restful web services without annatations. Any example source code will be very thankful

Regards, badri
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The basics of a RESTful service are generally so simple that you do not need annotations or any particular toolkit.

The standard Java library for HTTP connections and the servlet API is all you really need.

How many functions will your Android client be using?

Bill
 
badri raj
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you William for your reply.We are using 6 to 7 functions where they will invoke web services.Can you give the example for what you have suggested


Regards,
badri
 
badri raj
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And one more request is can you give the source code of web service where it won't use the annotations and returns a JSON object.This is the actual requirement for our application where the web service won't use annatations and returns a JSON object.Any source code example is very thankful
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't understand what you mean by "which is not going to recognise the annatations as it is IBM specific" - a library like Jersey can be used in any servlet container; it comes with all jar files necessary to develop with it and deploy it. There's nothing IBM-specific about JAX-RS annotations.
 
badri raj
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dittmer,

we are getting the below mentioned exception when we are using Jersey(jars) implementation to create web services in RAD7.5(6.1 test server)


com.ibm.ws.jsp.taglib.TldParser endElement JSPG0235E: The JSP container failed to load the TagExtraInfo class [com.ibm.wps.engine.tags.PortletTitleTag$TEI]
[5/9/11 14:47:17:118 IST] 00000015 jsp W com.ibm.ws.jsp.taglib.TldParser endElement JSPG0235E: The JSP container failed to load the TagExtraInfo class [org.apache.jetspeed.portletcontainer.tags.InitTag$TEI]
[5/9/11 14:47:17:290 IST] 00000015 PackagesResou I Scanning for root resource and provider classes in the packages:
com.nytimes.atw.admagmt.android.service
[5/9/11 14:47:17:368 IST] 00000015 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl initialize FFDC0009I: FFDC opened incident stream file D:\Program Files\IBM\SDP\runtimes\base_v61\profiles\AppSrv04\logs\ffdc\server1_00000015_11.05.09_14.47.17_0.txt
[5/9/11 14:47:17:431 IST] 00000015 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl resetIncidentStream FFDC0010I: FFDC closed incident stream file D:\Program Files\IBM\SDP\runtimes\base_v61\profiles\AppSrv04\logs\ffdc\server1_00000015_11.05.09_14.47.17_0.txt
[5/9/11 14:47:17:477 IST] 00000015 ServletWrappe E SRVE0100E: Did not realize init() exception thrown by servlet Jersey REST Service: java.lang.TypeNotPresentException: Type javax.ws.rs.Path not present
at com.ibm.oti.reflect.AnnotationHelper.getAnnotation(AnnotationHelper.java:38)
at com.ibm.oti.reflect.AnnotationHelper.getDeclaredAnnotations(AnnotationHelper.java:50)
at java.lang.Class.getDeclaredAnnotations(Class.java:1648)
at java.lang.Class.getAnnotations(Class.java:1609)
at java.lang.Class.getAnnotation(Class.java:1589)
at java.lang.Class.isAnnotationPresent(Class.java:1676)
at com.sun.jersey.api.core.PackagesResourceConfig.init(PackagesResourceConfig.java:122)
at com.sun.jersey.api.core.PackagesResourceConfig.<init>(PackagesResourceConfig.java:78)
at com.sun.jersey.api.core.PackagesResourceConfig.<init>(PackagesResourceConfig.java:89)
at com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:516)
at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:164)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:197)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:218)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.init(ServletWrapper.java:319)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.initialize(ServletWrapper.java:1250)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.initialize(ServletWrapper.java:152)
at com.ibm.wsspi.webcontainer.extension.WebExtensionProcessor.createServletWrapper(WebExtensionProcessor.java:99)
at com.ibm.ws.webcontainer.webapp.WebApp.getServletWrapper(WebApp.java:882)
at com.ibm.ws.webcontainer.webapp.WebApp.getServletWrapper(WebApp.java:804)
at com.ibm.ws.webcontainer.webapp.WebApp.initializeTargetMappings(WebApp.java:522)
at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinish(WebApp.java:359)
at com.ibm.ws.wswebcontainer.webapp.WebApp.initialize(WebApp.java:292)
at com.ibm.ws.wswebcontainer.webapp.WebGroup.addWebApplication(WebGroup.java:92)
at com.ibm.ws............................................................................................................
................................................................................



regards,
badri
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If this was my problem I would first try to get Jersey working in your environment - the problem may be as simple as putting JAR files in the right place. The Jersey users mailing list might be a help here.

If you want to start from scratch, the javax.servlet.http.HttpServletRequest interface has methods for dissecting the parts of a request as used by a RESTful service to locate a resource, extract parameters, etc.

Bill
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic