Creating Java Web Service using Google AppEngine - java

I'm trying to create a simple web service application where I can retrieve a collection of strings and store them into a data store on the AppEngine server.
I have knowledge in Java and barely any knowledge of Java Servlets and its WAR standards.
I would like to at least have some direction on how to create a web service using the Java technology AppEngine provides. I've searched but the articles are sparse and too lengthy while not providing any simple solutions.
I'd love it if I can create a web service using Java's annotations just like you can do in .NET with attributes.
I'd appreciate links to articles and guidance a full source answer is not required but would be appreciated.
No python based answers please.

IMO, there is no simple solution to build a Web Service on GAE with Java.
But, it's still achievable. Let's start with the Web Services we want to build.
In common usage the term refers to
clients and servers that communicate
over the Hypertext Transfer Protocol
(HTTP) protocol used on the web. Such
services tend to fall into one of two
camps: Big Web Services and
RESTful Web Services.
"Big Web Services" use SOAP/RPC format and RESTful Web Services use REST style one. You can read more about SOAP vs REST.
There are lots of Java open source Web Services frameworks out there. Most of them are generally based on the Java API for XML Web Services (JAX-WS), part of the Java EE platform.
JAX-WS is not supported by Google App Engine as specified in the list Will it play in App Engine. So forget about the "cool Java's annotations".
But, Restlet seems compatible with GAE. So if you think REST could be an option for you, I would go ahead and take a look at the Hello World tutorial of Restlet. Then, I'd go ahead and read the article on how to integrate Restlet with GAE.

Related

Possible to include Client JAVA API libraries in Web-services?

We want to develop a Java based Web-services (since the API's we want to use are Java based)
I would like to know if it's possible to use the IBM Rational Team Concert Plain Java API's (https://jazz.net/downloads/rational-team-concert/releases/5.0/RTC-Client-plainJavaLib-5.0.zip) as part of the Web-servicesand deploy them in the server?
Basically we use these API's on a client based Java applications. What I am looking at is more like a services which can be consumed by many applications
Anyone has any experience in deploying the client based API in the server as Web-services?
After multiple tries, it is possible to use the RTC Plain Java API's as Webservices.
How I did:
Followed the simple Webs Service creation tutorial (http://wiki.eclipse.org/Creating_a_Bottom-Up_Java_Web_Service)
Adapted to my needs
First added the "RTC plain Java API's (JAR's)" to the Eclipse build path
Then added the "RTC plain Java API's (JAR's)" to the "WebContent/Lib/" folder of my Dynamic web project
Created a new Web service & Web service client
I was able to login to RTC via this for starters

Java web service

I am new to web services and below I am sharing my understanding so far by reading on net:
Apache Axis and Apache CXF - are web services frameworks used to develop Java web services.
JAX-RS - Java API to develop Restful web services.
JAX-WS - Java API to develop SOAP web services.
Is the above correct? Or if you want to add something to it.
In my project, I am going to use web services with Spring framework.I am told that project will have both SOAP and RESTful web services.I am very much new to this.
Can somebody please guide me in this regard by sharing some valuable information or any good link which will make me understand better?
Your statements are correct, but it's not clear whether you've understood one crucial fact: CXF and Axis are both implementations of the JAX-WS standard. CXF additionally implements JAX-RS, and there are some libraries that only implement JAX-RS, such as Jersey (Oracle's reference implementation) and RESTEasy from JBoss.
For your project, the big question is whether you will only consume those webservices, or also publish them. If you need to publish a webservice, you'll have to include the entire implementation library and learn to use it. If you only consume the services, you'll just need some generated client and data binding classes.
Another question is whether your RESTful services will talk XML or JSON (SOAP always uses XML), as you'll need a parser or binding framework for JSON (JAX-B for XML is included in recent JDKs).

Google App Engine (Java) web service authentication/authorization/security

I currently have a Google App Engine app consisting of two parts:
A website using old school JSPs
A RESTful service implemented in Jersey
I've been trying to figure out how to shoehorn authentication into the web service but am rather lost since I've never used Spring before, and it sounds like that's the way to go.
Must I use Spring, or can I use Java EE? Are there any examples of how to accomplish this with Google App Engine?
Also, if I can get a high level description of some best practices for securing web services, that would be cool.
Thanks
Mark
app engine has built in OAuth support, which should do what you want.
I recomend you use apache shiro instead of spring because performance more over if you haven't got experience with spring. Apache shiro is a security framework and it could be integrated with GAE. You also can find a example in githubhow integrate the framework in GAE with Guice library.
Anyway for use Spring in GAE you also can find same best practice on Google Cloud Platform documentation

Restlet vs Spring MVC for Restful web service

I'm researching how best to create a Restful web service on Google app engine. My end goal is to have an Android application call a web service on GAE to post and get data. At this point I not sure what the best approach is.
What I know at this point is Spring MVC 3 provide the ability to create web service but it does not provide a full implementation of JAX-RS. I also have read a few blog that talk about how Spring and Restlet can be integrated together. On the other side I have read that I could only use Restlet in GAE. I would also like provide a light web interface for users to view their posted data
So my questions are the following.
1. Should I just use Restlet.
2. Should I just use Spring MVC to provide my Restful web service.
3. Should I use Spring and Restlet together.
At this point I think I should invest my time in Restlet because that seems to be the best approach for calling web services in Android. I'm also debating if Spring MVC is just over kill.
Any thoughts would be helpful.
Have a look at the following similar questions:
Easiest frameworks to implement Java REST web services and Can anyone recommend a Java web framework that is based on MVC and supports REST?
I recently set up RESTlet on GAE and it was an absolute breeze! There are docs outlining the procedure on the RESTlet website and I was up and running RESTlet on GAE using the Google datastore within two hours.
The major downside is that performance of the Google data store for low volume apps is atrocious. Timeouts are not uncommon. (Google mandates a maximum 30 second request time and your app can easily take up half of that in coming out of hibernation if it hasn't been accessed recently)
Right now I am building another RESTful app and chose to go the Spring 3 MVC / Hibernate / MYSQL route. I am not new to Spring DI or MySQL, but I am new to Spring MVC and it is taking me days to work through all the issues I am encountering. I am disappointed in the quality of available documentation and I have not been able to find a reasonable and complete Spring 3 MVC RESTful CRUD tutorial anywhere. Argh.
I don't have experience with Restlet but Spring MVC 3.0 is quite powerful for building restful webservice AND webapps. So if you also plan for your service to be accessible through browsers then it is a great solution since your controllers can serve both apps and browsers.
Perhaps this is also possible with Restlet but I have not heard of its capabilities for building webapps.
Just beware that Spring has a high loading time. This means that you have to be careful to avoid slow responses from cold starts.

Consuming web services with jboss

Can someone point me a good step-by-step tutorial to consuming an already running web service in java?
PS: I tried creating the classes with wsconsume, but it cries with
[ERROR] rpc/encoded wsdls are not supported in JAXWS 2.0. (my web service is rpc/encoded)
If I can consume web services entirely by hand (using no wizards), and understand how is it working, then I'll be happy.
Thanks!
Update: I have found out that rpc web services are not consumed using jbossws, but jboss-jaxrpc, which implements the JAX-RPC specification. I've found a guide for JAX-RPC here, but I'm still looking for other guides that could help.
Apache CXF is the easiest way to get webservices running. Specifically look at the Simple Frontend. The simple front end uses reflection to convert the method/data types to a webservice. It doesn't get much easier than that.
CXF is pretty stable, but does not include all the WS specifications (WS-Eventing for example).
How about the JBossWS website? The details on the client side wsconsume tool are probally what you will look at first.
If you have the WSDL and XSD files, you can use the Axis web-services library to create Java classes that will interact with the services they describe. From the stand-point of this library, you are creating a client application.
You can also consume web services with Spring WS.

Categories