Can I consume a web service from an appengine app? - google-app-engine

I have an appengine app that I want to use as a front end to some existing web services. How can I consume those WS from my app?
I'm using python

You would use the URLFetch API.

In addition to just URLFetch and hand constructing SOAP envelopes, you can also use higher level SOAP libraries like SUDS. Which can parse WSDL and construct requests for you. For performance reasons you will want to cache the WSDL. In one project I parse this offline and deploy the optimised code with the application.

Related

Developing a web client without servlet

I m new to appengine development.I have a few basic question about web client for appengine.When we make a google cloud module in Android Studio, an android client, a back end and a WEB CLIENT is auto-generated.A few files are auto-generated for web interface. My questions are:
why do I need WEB-INF/web.xml for web client? I also found there's a servlet api dependency added in gradle, though I didnt find and servlet file, what is it used for ?
I want to make a web interface/client for my andorid app, but I dont
know servlet,jsp, can I make it with pure javascript or js lib?
Will the default template for web client work from any other web-hosting
than appengine?
How can I make a web client with pure javascript,css,html, will the
google cloud doc for javascript suffice for this purpose?
why do I need WEB-INF/web.xml for web client? I also found there's a
servlet api dependency added in gradle, though I didnt find and
servlet file, what is it used for ?
Both are base elements for Java web applications even though you are not using servlets most modern web frameworks are built on top of them.
I want to make a web interface/client for my andorid app, but I dont
know servlet,jsp, can I make it with pure javascript or js lib?
Yes, GAE are standard web applications so you can build and app using pure HTML + js.
Will the default template for web client work from any other
web-hosting than appengine?
short answer, no. The App engine SDK depends on several APIs available strictly on the GAE environment. Shouldn't be hard to get an empty webapp template working on a tomcat thought.
How can I make a web client with pure javascript,css,html, will the
google cloud doc for javascript suffice for this purpose?
I dont know exactly what you mean by "the Google cloud Doc" but mostly the answer is yes, all App Engine, Cloud Compute and Google Drive are capable of hosting HTML+JS.

Finding a backend for an agularjs app for gae

I am building an angular app and the next step is to put it on GAE and I was wondering what backend should I use. I have my html pages ready I just need now to set up a backend so I can store and retrieve data for my little project. An information on this would be great. I don't think I would need to use jinja for this.
Well, as you say, Angular will be used for UI. For the backend, GAE being PaaS, it gives you number of services. One of the services is persistence. It's done using either the Data Store Service (NoSQL) or Google Cloud SQL. You can also make REST API around your persistence and business logic in the backend using Google Cloud Endpoints that you can use in JavaScript client.
To develop the backend and make use of these services you have many options: PHP, Python, Java, Go, ... . You can pick the one you like and more familiar with.
If you decide to use Java, you may want to take a look at Objectify. It makes your persistence code simpler and clearer than using the Data Store API directly. Also Google Plugin for Eclipse will make it much easier for you.
Note that although I used links here for services in Java, there are similar pages for python and other languages too. So you can use the same services in your favorite language.

JAX-RS services in Google App Engine

I'm developing a Google App Enigne application that uses some REST services and offers in turn web services. I'm using the GAE Eclipse plugin. I have 2 questions:
What is the best JAX-RS library to use with GAE nowadays? I'd like to use Jersey because I understand is the most "standard" library (isn't it?), but I could use any in principle... I've been looking for documentation, but I've only found some samples in blogs that only work with old versions of Jersey, etc...
For the web services I have to offer, I thought of using JAX-RS as well, but now I'm not sure if it's the best option...
You can use Jersey 1.5. You can see all frameworks that will play on GAE at http://code.google.com/p/googleappengine/wiki/WillItPlayInJava
But GAE has realized on version 1.7.5 as experimental service Endpoints which in term are rest service. Check https://developers.google.com/appengine/docs/java/endpoints/
For web service I don't know if you mean soap service..JAX-RS is the specification for rest service, instead you should use JAX-WS I don't try the compatibility with this specification.
After a little research on this subject, I've found out that the best way to offer web services from Google App Engine is using Google Cloud Endpoints, which is still an experimental technology but as far as I've tried, it works well. Furthermore it is very well integrated with GAE and the Google Plugin for Eclipse.
To cosume REST services from Google App Engine, I've opted for using just Java build-in HTTP client library as explained here. I don't know if it's the best way, but it is very simple and you avoid compatibility problems that could arise between GAE and JAX-RS APIs such as Jersey.
In order to work with JSON in GAE (very useful for RESTful services), I'm using Google's gson, which is a Java library that can be used to convert Java Objects into their JSON representation and vice-versa.

GWT and Google Docs API

I'm using GWT to create a simply app that allows teachers to create easily their own lessons.
The App is going to be on Google App Engine but I want to store lessons in user's Google Docs space .
Is it possible?
As far as I know gwt transforms java into javascript but google docs api is java, do i have to upload the java library to de app engine storage?
any place to start? any advice?
Thanks...
You need server side proxy for GWT client.
Your GWT client communicates with the servlet. The servlet is the actual agent using the google docs API.
Please read my explanation at http://h2g2java.blessedgeek.com/2010/05/accessing-google-userservice-from-gwt.html.
It explains how to get a GWT client could communicate with a Java based Google API. It explains that since GWT requires all Java source involved to be available to the GWT compiler, there are cases that you simply cannot get GWT client to do the task directly.
http://h2g2java.blessedgeek.com/2009/08/tablemgr-gae-gwt-gdata-with-rpc.html similarly explains how to combine gae + gwt + google docs, using the proxy approach. The posting is quite old and therefore the web site it points to does not work anymore because I have not updated the gae app with google mandated authentication measures. But it should work on your local machine.
The above subscribes to a webserver flow paradigm.
However, Google APIs are essentially REST APIs, which allows you to access them directly using your javascript or GWT client. So, instead of using the Java docs for Google APIs, you need to read the Google REST API docs.
http://code.google.com/more/, among other whatnots, provides a list of all the Google cloud APIs. To avoid using the webserver-proxy flow paradigm, choose the javascript or REST version of the API docs.
Here is the google docs/data API:
http://code.google.com/apis/gdata/docs/client-libraries.html.
Choose the javascript API:
http://code.google.com/p/gdata-javascript-client/
I advise you to first practice using these APIs by coding in javascript. Then you would get a good grasp of what you need to do in GWT.
You should use the GWT API for authentication prior to accessing the Google REST APIs.
http://code.google.com/p/gwt-oauth2/.
Essentially, you are obtaining an authenticated token which your client could use to access Google's data thro their REST APIs.
FYI, REST APIs are, in plain speak, URLs in a defined specification, where data transmission is by convention mostly in JSON or XML.

Does Google App Engine Support JAVA Proxy API's?

I have a question surrounding the REST service. I have an application written in C# , i want to put this application onto the cloud. I have a small problem, My Application has a built in C# API. I want to interact with my application and Google app engine. I want to develop a JAVA PROXY on top of GAE so that it can interact with my application using REST protocol and performs CRUD operations on Cloud and returns back data to my application.
Is it possible to do this ? to what i know is that SANDBOX feature doesn't allow us to directly interact with the App Engine.
Any suggestion on this.........
Thanks Heaps
Suraj
You don't need Java Proxy API in order to make http requests to another server (I guess you did not have java's Proxy class in mind?).
Yes, AppEngine can make HTTP/REST requests to other servers via URL Fetch java API.

Resources