GWT with Apache CXF - gwt

I am working with gwt code which involves call to web-service. We generated stub for web-service using Apache CXF. It generates all the request and response types. (I am not gwt expert) What I understand is, you need to have Common Data Models( Serilizable ) for accessing model classes on client side. Can we access model classes generated by Apache CXF on client side also ? Or Do we need to replicate all these classes for accessing them in client side ?

You need to first reference this before deciding which approach suits you best.
Depending on your performance requirements and screen type ( form vs chart vs tabular data ) you would have to choose the server communication type.
I am guessing RPC Or Json with Requestbuilder will serve you best. In both cases you might choose to have your own model classes layer on client side ( to be lightweight ).
If you intend to use CXF generated models then you would need to put them in shared folder of GWT and avoid pushing in data that is not serializable by GWT.

Related

GWT saving values from HTML form to database

I am starting a new project in GWT on Jetty. I have read a lot about GWT applications and accompanying technologies. I will use GWTP as a realization of MVP pattern.
But, what with sending data from a form to database. On server side, I want to have transaction for every action. Should I use JPA or Spring? I know that in some frameworks validation of form is defined in one place, is it possible in GWT? Or maybe I have to define it in at least two places on client and then in server?
There is a lot of libraries for GWT. Are Guava, iBatis, Hibernate helpful
for transfering data from client to server and then persisting it. What combination of libraries are you using for these kind of problems?
GWT---rpc--->HIBERNATE----------->Mysql
You can use any java library or framework (Spring, JPA, iBatis and ...) that fulfill your requirements on server side of your GWT application.
About validation in GWT applications, GWT has validation mechanism (based on JSR 303) and also there are several third party GWT library (e.g. gwt-validation) for client side validation. In the server side you can use Java validation library. I recommend you to use both server side and client side validation.

gwt serialize and de-serialize object from and to a string (client side only)

I have java objects used in GWT RPC calls. On the GWT client I need to store these objects in a web sql database. I need to be able to convert these objects to a string and then also de-serialize them from the string. I have seen many aproaches JSON, AutoBean, various other libraries but none seem to be able to handle circular references which I do have in my objects.
Anyone know of a GWT library that can handle my requirements?
GWT RPC itself transmit responses to the client using JSON and handles circular references okay (at least I think so) - So I cannot see why this mechanism cannot be re-used. Any ideas?
If the Web SQL service conforms to JAX-RS or Jackson JSON, use RestyGWT.
There is no conversion necessary on your part. RestyGWT encodes your POJOs to Jackson-compliant JSON.
The flip-side is you would have to read up on JAX-RS, JAXB, Jackson annotations. Which is not a flip-side to me but an exciting opportunity to learn a widely used web service technology.
GWT RPC itself transmit responses to the client using JSON
that is an inaccurate perception.
GWT RPC object encoding is deliberately obfuscated and difficult to decipher and format stability is not guaranteed from version to version.
there is no json in the RPC data interchange.
If your statement were true, then you would not have needed a servlet that extends GWT RemoteServiceServlet to service a RPC request.
BTW, what web SQL service is that? Proprietary in-house?

GWT: Integrating 3rd party webservices and exposing via REST / gwt-RPC to gwt-client

I'm a seasoned Java developer but new to GWT.
Consider a 3rd party http POST based webservices api, not completely REST based since there's configuration of servlets, among other things, to invoke these services. I'm building gwt components extending the base gwt composites and using these 3rd party data services to fetch/mutate the data.
In the normal java world, I'd have build a REST wrapper on these services and exposed them as Pojos via JaxB Xml/Json. In GWT, however, I read GWT-RPC will be the fastest, given the serialization required. The data is expected to be large (several thousands, paginated).
What's the best way to design the 'bridge' between the 3rd party data services and the gwt client components?
I ruled out RequestFactory since we have a custom servlet provided by the 3rd party that fetches the webservices.
Adding a rest wrapper adds a 3rd layer of indirection (3rd party api+rest+gwt-rpc serialization) that felt too heavy
Suggestions for a low latency design, where I don't have to write too many wrapper classes for each service call (pojo)?
I'd like to consider jaxb on the server side, making schema as the new contract, and converting them to JSON for gwt-client.
I am using RestEasy on the server side, which uses Hibernate JPA to access database. With a little modification, I should be able to switch over to Datanucleus JPA.
I am using RestyGWT on client side.
With careful consideration on the DTOs, I am able to
- share the same DTO between server and client
- share the same REST interface between server and client (after running a script over the server side REST interface to transform the return type into an async callback).
Integrating multiple GWT applications into a pluggable platform.
Currently I am also trying to merge JPA DTO with REST DTOs so that I have a single set of POJOs between server, database and client. Each DTO POJO would therefore have a mix of JAX-RS, JAXB, Jackson JSON and JPA annotation.
To reduce unnecessary client-server traffic, I use JSP as GWT hosting file in tandem with GWT Dictionary class to transfer all session-specific session-static information to the client.
My Suggestion would be to use Spring RestTemplate, Gwt-RPC and have a RemoteServiceServlet/Spring bridge - that would give you RPC calls via a POJO from Server-Client and a clean tier to communicate with your external web services..
This will be lightweight and clean..

How to design a Eclipse RCP (Client/Server) using EMF for the model?

We are planing a project where we will have an eclipse based client communicating with an glassfish server (+ Oracle database). The business logic will reside on the server, the client should act more or less as an view. We consider using EMF for our model (+ hibernate + teneo).
I'm not quite sure how this all works together. The workflow/architecture/whatever I imagine is something like this:
Create EMF model
Generate java model (+ edit code) from it
Use java model on the server together with hibernate/teneo to persist model objects in database
Create a SOAP interface in the server, serialize model objects to XML as appropriate
Use model on the client to access the SOAP interface of the server, serialize/deserialize model objects from/to XML and display (parts of the whole) model in eclipse
Is this basicly how it is intended? Or have I missed a central concept?
The link you are missing is called CDO. You can use this to transfer a live model to your client. So replace SOAP with CDO, and you are there!

client server semantic data transfer with GWT

In short, how do you transfer semantic data between client and server with GWT and which frameworks do you use? Read on for more details that I've thought about.
For example, using GWT 2.2.0 features like the RequestFactory will bring the constraint to have java beans transferred while the semantic resources are represented as triples and a resource can have a varying set of properties. So the RequestFactory itself cannot be shaped to transfer semantic-driven data easily.
A way to do that would be to use RequestFactory with beans that represent triples. Such bean would have 3 properties: subject, predicate, object. These beans will be transferred to client which will know to query, change their properties and then send them to server. This approach will however need a custom implementation(there are no GWT-based frameworks to represent semantic data on client-side, from what I've searched so far) and that could prove buggy or unoptimized. I've seen this approach in this project: http://code.google.com/p/gwt-odb-ui/ - it used GWT-RPC and implements some classes that represent semantic resources. However, I think it's in an incipient stage so I'm reluctant to copy their model.
Also, I've found that Restlets is a framework that supports the semantic web approach to applications. However, there is no documentation or an example on how to use Restlets with Semantic Web and perhaps with GWT. Also, Restlets is also supporting GWT. Does anyone know if this is a viable solution or not?
Thank you!
Restlet should work quite well for you. It has a GWT edition able to automatically serialize your triple beans. In addition, it also comes with an org.restlet.ext.rdf extension, including a Link class similar to your triple bean idea.
For further documentation, I would suggest the "Restlet in Action" book which covers GWT and the semantic web from a Restlet and REST point of view.