I have a Dart project want to reuse the existing GWT service (RemoteServiceServlet), any way can do this?
There is no special support for GWT-RPC included in Dart and there seem to be no 3rd-Party apps available that provide this functionality.
This question is similar (but not Dart)
GWT Data Serialization
If you're feeling ambitious, you can write a Dart client that understand the GWT-RPC wire-protocol and use that to communicate. This is likely to be a great deal of work however.
I had a similar situation where I needed to access GWT-RPC Services from a non-GWT client (it was JavaScript, not Dart, but the same concept applies). Instead of accessing the GWT-RPC service directly, I ended up using jsonrpc4j to setup a JSON-RPC service alongside GWT-RPC. I was able to point jsonrpc4j at the GWT services to use, so there was no code duplication, just the extra code needed to wire up the JSON-RPC.
Then you will need a Dart JSON-RPC client, of which there are a few available: jsonrpc, jsonrpc2.
This all assumes that you have access to the GWT server and can setup the JSON-RPC service.
Related
We are about to create a mobile version of our web page. In that page we have used RPC services in a service way, not totally entity oriented. So we are going to have two clients (web and mobile) calling one server.
Now we want to reuse all that server code supporting several client versions and avoiding all the "dto version hell" that the RPC calls have.
I have seen that we need to create a wrapper, another layer in the server, for exposing methods to the mobile versions (GWT+phonegap and in the future: IOS, Android...). Later this layer would reuse all the server code (model, repositories... etc), in the server the access to BigTable is done through Objectify.
Which technology would you use for this new layer?
For mobile apps I like to use AutoBeans + RequestBuilder on the Client and AutoBeans and Restful API which (also) produces JSON on the server side.
With AutoBeans you define the structure of your data with Java interfaces. (Which gives you something to program against) and AutoBeans handles the conversion from Object to JSON and from JSON to Object for you on the server and on the client as well.
In combination you can build a very fast and good architectured RPC. AutoBeans is used by RequestFactory as a default mechanism for serialization.
If you ever decide to support other platforms you can still use the JSON and parse it there. If you decide to support a native android application the AutoBean mechanism should just run fine on the android vm.
A good example for AutoBeans can be found here: http://code.google.com/p/google-web-toolkit/wiki/AutoBean
I have my restful CXF service producing JSON with default JSON provider. I want to know if we can use GWT to build client which will user the restful service. Will it work ? If not, what would be a simple work around for this type ?
Thank you.
regards
It will work. See this. Here's a quote:
GWT does not limit you to this one RPC mechanism or server side development environment. You are free to integrate with other RPC mechanisms, such as JSON using the GWT supplied RequestBuilder class, JSNI methods or a third party library.
Is it possible to write a server side of GWT application in other languages then Java if yes how to use GWT-RPC mechanism, an sample code please
Thanks
Please read the GWT documentation Communication with the Server:
If you can run Java on the backend and are creating an interface for your application's server-side business logic, GWT RPC is probably your best choice. [...]
If your application talks to a server that cannot host Java servlets, or one that already uses another data format like JSON or XML, you can make HTTP requests to retrieve the data.
You can write your server in any language you choose, GWT is just JavaScript to be run in your users' browsers.
If you decide to go that route, you should look into using RequestFactory to communicate with your server instead of GWT-RPC, which is Java-specific. RequestFactory uses standard JSON, which any language can read/write.
Dont waist your time with GWT-RPC. It's bad. Use RequestFactory. I am surprised people are promoting GWT-RPC. It's a broken toy.
im searching for a GWT-RPC lib for the client side to communicate with a zend framework php server
thus rpc like json, xml or rest would be interesting
all i find are projects which have been stuck in years 2007/08 which dont seem to work anymore
so is there anyone who can suggest a working library?
thx
As far as I know nobody has built a GWT-RPC to communicate with a non-Java server, to allow you to have the automatic object sharing between client (written in Java) and server (written in non-Java) that GWT-RPC provides.
Luckily, GWT provides a mechanism for communicating with a server in regular JSON, using RequestBuilder. See this link for more information about making regular HTTP requests in GWT.
For web application development, I've been steeped in dynamic languages such as Ruby, PHP, and Python. Using popular frameworks for these languages, all my knowledge about HTML, CSS, and JavaScript transfers fairly straightforwardly: templates are basically HTML with embedded code that the server executes to generate the dynamic sections of the page.
Lately, I've been thinking about using GWT for building the UI of my next project. At this point, I'm just trying to wrap my head around how development with GWT works, as seems to follow an entirely different paradigm. In addition, it seems there's an unstated assumption that the server-side part of the app is written in Java. Would it be impractical to use something other than Java for the server side?
Related question:
GWT + GAE python: frameworks for COMET & RPC
While not actually impractical I would say that you get the most value from GWT by having the same code on client and server, since it allows for easy code reuse (fx. if your data objects are serializable then you could just send them directly to the client). So I guess my answer would be; yes you can do it and it's going to be more work than just having Java on the server side.
I don't think there's any requirement that you use Java on the server. At the end of the day, GWT compiles Java to JavaScript. You can do all the comms via the RequestBuilder object, you don't have to use the RPC services.
I guess the question is: if you don't like/know/prefer Java on the server side, why would you use it on the client when it's effectively an abstraction over JavaScript anyway?
There is no requirement to use Java on the server side. GWT supports JSON out of the box. Any server side component that can generate JSON ( or other supported serialization methods ) will work. You could use PHP on the server side, or bash shell scripts, it doesn't matter to the Javascript code that is generated by GWT.
Yes, it can be practical. I use Rails as my backend and GWT/GXT as my frontend. I love every bit of it! I couldn't stand worrying about browser incompatibilities, so GWT/GXT was a real joy. Also, I had already started my backend in Rails and did not have much experience with Java on the server, so I stuck with Rails.
You may want to take a look at an appropriate GWT Rest framework, as you won't be using RPC.
As an aside, there is one exception where you should use Java on the server. That's if you want to use Google App Engine.
Feel free to ask me any specific questions and I'll be happy to help you out.
Good Luck.
-JP