开发者

How to invoke a gwt rpc servlet from c or c++ client using libcurl?

I have a google app engine application with a GWT client. Most server functionality is accessible through normal GWT RPC calls as usual. I am writing a data mining application in C++ which needs to comm开发者_StackOverflow社区unicate with the appengine application. Problem is, there are just too many gwt servlets implemented so a rewrite of server code is out of the question.

Any ideas?


If you were using java on the client you could use GWT SyncProxy. Although main usecase of this library was to test remote gwt rpc service, but it can be effectively used for any purpose. As you are developing your client in C++ this might not be an option for you.

If you control the GWT application (that is you can recompile it), you can probably do something like this:

  1. Export RPC related functions into javascript. That is make specific functions of your GWT code made available to be called as normal Javascript functions from within the host page. See this article for a tutorial

  2. Use a embedded browser engine like webkit and load your GWT module script in it.

  3. Call the exported GWT functions as normal java functions.

But it will probably prove to be too much work, so you might be better off refactoring the servlets to expose another JSON/XML based interface in addition to RPC.


Solved, the best way to go is as Tahir suggested. Trying to connect to GWT rpcs directly from C++ is just too much work. The easiest way was to write thin wrappers on the server side as normal servlets and use http and curl from C++. One issue remains about object serialization to JSON or XML. I elected to write a custom annotation on the object fields which I wanted to serialize and then read these annotations at runtime in order to serialize them.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜