views:

48

answers:

2

I expect it should share a common description, like XmlSchema or IDL and should generate classes for target language.

I found Thrift and it's really nice solution, but it doesn't support structures polymorphism. I would like to have collections of base class objects, where I could place instances of subclasses, serialize this and deserialize at the opposite side. Some mechanism of polymorphic behavior support, like Visitor, would be a perfect.

Does anybody know something suitable for these requirements?

A: 

I would suggest trying Protocol Buffers. It is a Google originated technology so I would imagine it is well supported by C++ and GWT.

http://code.google.com/apis/protocolbuffers/

Peter Tillemans
As far as I understand they also do not support subclassing and any sort of polymorphism. This make it not better than Thrift.
A: 

As mentioned, something like Protocol Buffers would definitely be your best bet. It supports C++ and there are two separate projects that support GWT: protostuff and protobuf-gwt.

There are many comparisons between Protocol Buffers and Thrift, so if you're looking to use Thrift, it's possible to integrate with GWT as well, through the gwt-rpc-plus project.

Arthur Kalmenson
You mentioned gwt-rpc-plus. I tried to connect it to server-side C++ thrift part, looks like they talk different JSON-based protocol. C++ is more verbose, so it generates '[1,"xxx",1,0,{"1":{"str":"abc"},"2":{"str":"bcd"}}]', where GWT-RPC-PLUS does '[0,"xxx",null,["abc","bcd"]]'. Do you have any experience with it? Will protobuf-based stack resolve such problem?
Have you worked with protobuf-gwt? I have problems building it.
From the gwt-rpc-plus docs, it says that it generates client and server stubs from the Thrift files, I'm fairly certain it's generating Java stubs, no? How would you be using them in C++?I haven't actually used any of these libraries, sorry.
Arthur Kalmenson
I asked tbroyer on Twitter about this and he said to look here: http://groups.google.com/group/protobuf-gwt/msg/a7fda62e81f57f4f. I haven't tried the solution, let me know if it works for you. Good luck!
Arthur Kalmenson
gwt-rpc-plus doesn't support thrift protocol. gwt-rpc-plus has it's own protocol, to have a matching server side, you need to generate it with gwt-rpc-plus also. So, no communication with C++ original thrift server-side is supported.
Can't you just have the generated server side talk regular Thrift with your original C++ Thrift server side? I think it makes sense to have their own protocol for over the wire communication because you need to talk JSON with the GWT client side.
Arthur Kalmenson