RequestFactory VS Cloud Endpoints (App Engines Java Rest API)

1,179 views
Skip to first unread message

Nick Siderakis

unread,
Jul 7, 2012, 12:11:51 PM7/7/12
to google-we...@googlegroups.com
http://www.youtube.com/watch?v=v9TG7OzsZqQ&feature=player_detailpage#t=910s

It looks like the new Cloud Endpoints implement a lot of the functionality that makes RequestFactory attractive.
  • Patch commits - only send what has changed to the server.
  • Batch requests - RequestBatcher
  • Partial GETs - similar to defining a proxy with a subset of attributes.
It has the benefit of being a standard REST api, but is limited to App Engine Apps.

What do you guys think?

Patrick Jackson

unread,
Jul 7, 2012, 7:38:55 PM7/7/12
to google-we...@googlegroups.com
I would like to try out cloud endpoints and have signed up for trusted tester and have not received a reply.  I see there is a javascript library generated, but nothing specific to GWT.  Have you been able to use it with GWT?

Nick Siderakis

unread,
Jul 7, 2012, 8:29:56 PM7/7/12
to google-we...@googlegroups.com
I just signed up to be a trusted tester yet.  I need a public API for one of my sites, right now we're using Jersey and I'm looking forward to moving to Cloud Endpoints.

I hope there is a way to generate a GWT client library. :)

Thomas Broyer

unread,
Jul 8, 2012, 4:30:39 AM7/8/12
to google-we...@googlegroups.com
Looks really great!
I knew they'd been working hard for the past years to build a common framework for all their APIs, in a truely RESTful way, with discoverability (hopefully HATEOAS too, though I haven't checked), etc. (Joe Gregorio, who worked on the Atom Publication Protocol some years ago, as Google adopted it for the GData APIs, but before Joe joined Google, is part of this ongoing effort AFAIK) ; what I didn't see coming was to allow external developers to leverage that framework to build their own APIs!
It'd be too bad if it were limited to AppEngine and stayed closed source though…

Bob Vawter (who created RequestFactory along with Ray Ryan), created Flatpack in his new job, which uses a very similar approach to Cloud Endpoints, though leveraging JAX-RS on the server-side.
Now is this really "what RF should have been", as he wrote it, I'm not sure. But Flatpack doesn't (yet) has dirty-tracking.

BTW, does Cloud Endpoint client-side APIs have dirty-tracking? or you have to do it yourself and build "patch commits" by hand?

YatiRaj B

unread,
Jul 8, 2012, 10:31:48 AM7/8/12
to google-we...@googlegroups.com
I signed up for the  trusted tester some 3 days back and yet to get it. Do you guys know how long it took for you to get it, if anybody got it.

You can call me noob but from what I understood from the IO video, Cloud endpoint seem to replace the request factory approach. You don't need to use any request factory anywhere for the cloud endpoint based approach. Correct me if I'm wrong.

please let me know.

Thanks much,
Raj...



--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/xlw-9foMFuQJ.

To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Ümit Seren

unread,
Jul 10, 2012, 10:26:02 AM7/10/12
to google-we...@googlegroups.com
I think Cloud Endpoints are bigger than RequestFactory for GWT.
They are supposed to be a truly restful API for all Google Services (i.e. Cloud SQL, Datastorage, etc). 
However RequestFactory has some distinct features that AFAIK Clound Endpoints don't support yet (i.e. tracking changes and transmitting only delta's, batching, specifying the object graph that goes over the wire). 
I think it really depends on your use case and type of project. If you are doing a lot of CRUD (i.e. business application) and only access your backend via GWT then RequestFactory might be the better fit. However if you need to access your backend from different clients and also allow maybe a computer readable knowledge approach than Cloud Endpoints might be the better choice. 

Thanks much,
Raj...



To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsub...@googlegroups.com.

Thomas Broyer

unread,
Jul 10, 2012, 10:52:19 AM7/10/12
to google-we...@googlegroups.com


On Tuesday, July 10, 2012 4:26:02 PM UTC+2, Ümit Seren wrote:
I think Cloud Endpoints are bigger than RequestFactory for GWT.
They are supposed to be a truly restful API for all Google Services (i.e. Cloud SQL, Datastorage, etc). 
However RequestFactory has some distinct features that AFAIK Clound Endpoints don't support yet (i.e. tracking changes and transmitting only delta's, batching, specifying the object graph that goes over the wire).

Actually, Cloud Endpoints are reachable as REST or JSON-RPC, and JSON-RPC supports batching.
(and RequestFactory supports JSON-RPC ;-), but without batching for now, and with a bunch of bugs and limitations; that means you could very well generate RequestFactory interfaces out of an "API discovery description doc"; that would really be a killer thing!)
One thing you won't ever have outside RF are EntityProxyChange events, but they're hardly usable anyway so chances are you won't really miss them ;-)

YatiRaj B

unread,
Jul 10, 2012, 11:05:42 AM7/10/12
to google-we...@googlegroups.com
I like the idea of: "truly restful API for all Google Services (i.e. Cloud SQL, Datastorage, etc)"
That would be great!

On the other side, it seems Google has plans to make RequestFactory a thing of past. That's the reason, in new GPE version, you won't even see the option of "App Engine Connected Android App" which was a sample app (two apps rather: Android client and server) providing RF example.

Moreover, the RF validation tool really sucked big time. It took me 4 days to actually make it run. It only ran on Helios for me; when I was trying it on Indigo... jeezzzz!!!

Does anybody know how to get the "App Engine Connected Android App" option on the new GPE? I want to continue using RF till they open the Endpoints publicly.

Thanks,
Raj

To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/4esf56Y8QPEJ.

To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.

Thomas Broyer

unread,
Jul 10, 2012, 11:38:37 AM7/10/12
to google-we...@googlegroups.com


On Tuesday, July 10, 2012 5:05:42 PM UTC+2, AB wrote:
I like the idea of: "truly restful API for all Google Services (i.e. Cloud SQL, Datastorage, etc)"
That would be great!

On the other side, it seems Google has plans to make RequestFactory a thing of past. That's the reason, in new GPE version, you won't even see the option of "App Engine Connected Android App" which was a sample app (two apps rather: Android client and server) providing RF example.

It was removed because it used CD2M; it'll be added back using GCM.
 
Moreover, the RF validation tool really sucked big time. It took me 4 days to actually make it run. It only ran on Helios for me; when I was trying it on Indigo... jeezzzz!!!

Works for me in Indigo and Juno.
 
Does anybody know how to get the "App Engine Connected Android App" option on the new GPE? I want to continue using RF till they open the Endpoints publicly.

You'll have to downgrade to GPE 2.6.1 (see link above) 

YatiRaj B

unread,
Jul 10, 2012, 4:14:08 PM7/10/12
to google-we...@googlegroups.com
Great thanks Thomas!

That group thread is just 2 days old (where they told to downgrade to 2.6.1) and I tried all the things in the world to get that "app engine connected..." option back and lost my hope.

So what's your suggestion: Shall I wait for Endpoints to be open or shall I keep using RF? My hunch is Endpoints will be much more easier and less clumsy... no more proxies I guess

How long will it take for Endpoints to be open (at least for testers)?

Thanks again,
Raj.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.

Kevin Moore

unread,
Jul 15, 2012, 12:44:42 PM7/15/12
to google-we...@googlegroups.com
On Thursday, July 12, 2012 12:05:35 PM UTC-4, Daryl Bergeron wrote:
> +1. I signed up two days ago. Thought I might at least get a confirmation email that my request was received, but have not. Just anxious to get started on it, and don't want my request to fall thru the cracks. Thanks.
>
> On Tuesday, July 10, 2012 3:14:08 PM UTC-5, AB wrote:<blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">
> How long will it take for Endpoints to be open (at least for testers)?</div>
Daryl, and you could still test it locally with out deploying it...
>
>
> </div></div>
> </blockquote>

On Thursday, July 12, 2012 12:05:35 PM UTC-4, Daryl Bergeron wrote:
> +1. I signed up two days ago. Thought I might at least get a confirmation email that my request was received, but have not. Just anxious to get started on it, and don&#39;t want my request to fall thru the cracks. Thanks.
>
> On Tuesday, July 10, 2012 3:14:08 PM UTC-5, AB wrote:<blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">
> How long will it take for Endpoints to be open (at least for testers)?</div>
>
>
> </div></div>
> </blockquote>

On Thursday, July 12, 2012 12:05:35 PM UTC-4, Daryl Bergeron wrote:
> +1. I signed up two days ago. Thought I might at least get a confirmation email that my request was received, but have not. Just anxious to get started on it, and don&#39;t want my request to fall thru the cracks. Thanks.
>
> On Tuesday, July 10, 2012 3:14:08 PM UTC-5, AB wrote:<blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">
> How long will it take for Endpoints to be open (at least for testers)?</div>
>
>
> </div></div>
> </blockquote>

YatiRaj B

unread,
Jul 16, 2012, 1:45:59 AM7/16/12
to google-we...@googlegroups.com
Hi Kevin,

I don't know how you would do that.

After annotating appropriately as explained in Google IO video, when I right click and do "generate Cloud Endpoints...", I'm getting and error which doesn't tell anything about the error.
This is even before deploying.

I guess it tries to contact Google for the creation of the libraries (again as explained in Google IO video). And since I'm not granted Trusted Tester access yet, it fails. Just my initial conclusion.

If you know how to make it work alternatively, please let me know.

Thanks in advance,
Raj


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.

Kevin Moore

unread,
Jul 16, 2012, 1:49:18 AM7/16/12
to google-we...@googlegroups.com

I thought so also but that turned out to not be the case, it is is late for me now I promise I will send email tomorrow with exactly how to get it working locally....

YatiRaj B

unread,
Jul 16, 2012, 2:03:07 AM7/16/12
to google-we...@googlegroups.com
Wowwww! that's an exciting news!
Eagerly waiting for your reply! And thank you so much!! :)

Best Regards,
Raj

Kevin Moore

unread,
Jul 16, 2012, 3:57:21 PM7/16/12
to google-we...@googlegroups.com
As Promised...


For some reason... do the following...

Assumptions.. 
  • You have the Latest Eclipse(Juno)
  • You have installed all the latest APPEngine SDK 1.70
  • You have Java SDK 1.70 at least..
  • You Created a POJO 
  • You Generated your endpoint class by right-clicking on the POJO->Google->Generate Cloud Endpoint Class

The symptoms...you are experiencing
When you right mouse click on the
project then Google->Generate Cloud Endpoint Client Library... 
you get a quick flash and then nothing!!!

Solution
1. Click on the menu bar of the IDE
   Window->Show View->Navigator
2. This should take you to the Navigator Window.
3. Expanding the ".settings" folder in the Navigator window
   under your project.
4. double-click the file "org.eclipse.wst.common.project.facet.core.xml"
5. It should look like what I have below... but probably yours says ..version="1.7"
CHANGE IT TO "1.6" just like mine below...and save

<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
  <installed facet="java" version="1.6"/>
</faceted-project>

6. Your Project will the probably start to Complain
    so click on the "Window->Show VIew->Problem" option and
    choose to do the quick fix...
7. Your project will stop complaining...

8. Go back to Package Explorer and Google->Generate Cloud Endpoint Client Library
   Again this should now work.

BUT YOU WANTED TO TEST THE END POINTS
LOCALLY...RIGHT?

9. Once you are running you projects locally...
enter the following format on the url and..

where X = @Api(name = "thenameyouputhere")
and    Y =  your POJO name lowercase
DONT forget the v1
This should yield an empty JSON list!!!!
 
but because you can do a POST from the url
in your browser...

To test all of the inputs, this is best done with "CURL" even on a Windows PC
here is the link to get CURL

9. You only need for now the non-ssl version..
you will need the SSL version when you are
able to deploy to appengine... for now you will be testing locally...

10. once you have downloaded and installed curl ...
      go to the curl folder do the following...

11.
To ADD and Entry
curl --header "Content-Type: application/json" -X POST -d  "{\"X\":\"Some New Value"}" "http://localhost:888/_ah/api/Yt/v1/Z"
X = "Some Variable in your POJO that you Want to ADD (not the Identity)"
where Y = @Api(name = "thenameyouputhere")
and    Z =  your POJO name lowercase
DONT forget the v1

NOW repeat Step 9 then 11 again...

Hope it helps, let me know either way ...

YatiRaj B

unread,
Jul 17, 2012, 12:02:29 AM7/17/12
to google-we...@googlegroups.com
Hi Kevin,

Deeply appreciate your reply as promised! :)

I'll check if it works for me very soon today and let you know... just started the day :P

Thanks again!
Raj.

YatiRaj B

unread,
Jul 17, 2012, 3:07:49 AM7/17/12
to google-we...@googlegroups.com
Hello Kevin,

It didn't work for me :(

I'm working on HP 64bit WIndows Vista. Is that a problem for some reason? Not sure!

Here's what I have/did:
  1. I have everything latest: Juno, GPE 1.7 etc
  2. The system did behave as explained by you when I changed Facet to 1.6
  3. After the errors are gone, I right clicked the Project -> Google -> Generate Cloud Endpoint and it gave me error.
  4. I know this is not what you told. But I tried as it was on Google IO video
  5. As per your suggestion, I clicked on POJO->Google->Generate Cloud Endpoint and it gave me error: This is not a JDO/JPA entity class
  6. Of course it is not. But isn't it supposed to do on any class I want a service from (as long as I've the API annotations)?
  7. I'm pasting my example classes here below. Basically I created a class which accepts a number and returns the square of it. And another class that will work as my "Servlet" if I were to write a servlet: this takes the number from client requests and creates a square class with this number and gets the square of the number.
POJO Square:
public class Square {

int var;
int square;
public Square(int var) {
this.var = var;
this.square = var * var;
}

public int getVar() {
return var;
}

public void setVar(int var) {
this.var = var;
setSquare(var * var);
}

public int getSquare() {
return square;
}

private void setSquare(int square) {
this.square = square;
}
}


POJO SquareEndPoint:
@Api(name = "square")
public class SquareEndpoint {

@ApiMethod(name = "square.getSquare")
public int getSquare(int number){
Square sq;
sq = new Square(number);
return sq.getSquare();
}
}


I'll try on actual JDO/JPA class very soon. It may work but my other question remains: storing to DataStore may not me my only intention to create these endpoints. I might provide such simple service as: Celsius to Fahrenheit etc... But that's a different question. Let me 1st get this working! :)

your views on it?

Thank you!
Raj.

Kevin Moore

unread,
Jul 17, 2012, 3:18:19 AM7/17/12
to google-we...@googlegroups.com

Raj,
I have not tried to create a service as you did, I did it with a judo pojo.

can you please try the steps I suggested, using a
pojo , very simple one, then when it works modify the service to ignore the pojo and see what happens.

YatiRaj B

unread,
Jul 17, 2012, 11:20:16 AM7/17/12
to google-we...@googlegroups.com
Hi Kevin,

Sure I'll try on a JDO Pojo and let you know. Plz give me some time, I'm stuck somewhere...

Thank you for your support
Raj.

YatiRaj B

unread,
Jul 30, 2012, 9:06:33 AM7/30/12
to google-we...@googlegroups.com, kmoo...@gmail.com
Hello Kevin,

Sorry for late reply!
Finally I got to test your way of doing it. It worked but only partially! :)

Here is the info:
  1. I converted the POJO Square class into a JDO class and created the endpoint as explained by you. It all went well.
  2. I tried with both the browser and CURL method
  3. The GET worked fine with the empty JSON
  4. The POST "partially" worked as in everytime I entered new item, it only created the new ID for it but all the other variables inside the entity were empty. I mean after I do GET on all items. As below:
{
  "items" : [ {
    "id" : 1,
    "var" : 0,
    "square" : 0
  }, {
    "id" : 2,
    "var" : 0,
    "square" : 0
  }, {
    "id" : 3,
    "var" : 0,
    "square" : 0
  }, {
    "id" : 4,
    "var" : 0,
    "square" : 0
  } ]
}

I executed POST as follows via CURL:
C:\Curl>curl --header 'Content-Type: application/json' -X POST -d  '{\"var\":\"7\"}' http://localhost:8888/_ah/api/squareendpoint/v1/square

I tried to insert 3, 3, 7, 6 in the order. All four entities were returned without their values. Only IDs could be seen.

BTW, I got the trusted tester access... not sure how to use it but I'm gonna play with it soon. Do you know how or what changes?

Thank you!!
Raj
Reply all
Reply to author
Forward
0 new messages