Did some additional investigation on this by trapping the Response object 
in an exit filter and examining it. I found that the Response from Web 
service is way different from the GWT-Server side code. Given below are the 
screen-clips from both. Long story short - trapping the Jersey Web Service 
result on the GWT client side doesn't appear to be trivial.

GWT Server application Response object

<https://lh3.googleusercontent.com/-1RLWywNWCIg/WCJNostl4LI/AAAAAAABjSQ/jvK3f1tynNM8N_oW9-IRcW0xsNEA2EpFQCLcB/s1600/WebService-Response.jpg>

Web service Response object

<https://lh3.googleusercontent.com/-fnx65MmmZ98/WCJN22KkZhI/AAAAAAABjSU/uQtyN9_c8w0znMVqF6o-eNQdFWgPXtQ2wCLcB/s1600/WebService-Response.jpg>




On Monday, November 7, 2016 at 5:53:33 PM UTC-5, Velusamy Velu wrote:
>
> Trying to retrieve an object in my GWT client using JsonpRequestBuilder 
> from a cross domain server.  The call goes to server and server does 
> respond with the correct value but the client keeps throwing "Timeout 
> while calling http://localhost:8080/layouts/AVhARgXQW9-o1U_GgvJa"; 
> message. Here are the code snippets.
>
> The call is made from this class -
> public class EntityFisher {
>     public String fish(String id) {
>         JsonpRequestBuilder builder = new JsonpRequestBuilder();
>         String url = "http://localhost:8080/layouts/"; + id;
>         AsyncCallback<LayoutJson> callback = new LayoutFisherCallback();
>         JsonpRequest<LayoutJson> layoutJson = builder.requestObject(url, 
> callback);
>   ...
>         return t;
>     }
> }
>
> LayoutJson.java
> public class LayoutJson extends JavaScriptObject {
>     protected LayoutJson() {}
>     public static final native LayoutJson build(String json) /*-{
>         return eval('(' + json + ')');
>     }-*/;
>
>     public final native JsonArray<PointJson> getCoordinates() /*-{
>         return this.coordinates;
>     }-*/;
> }
>
> LayoutFisherCallback.java
> public class LayoutFisherCallback implements AsyncCallback<LayoutJson> {
>     @Override
>     public void onFailure(Throwable caught) {UiFlag.flag(caught);}
>
>     @Override
>     public void onSuccess(LayoutJson layoutJson) {
>         JsonArray<PointJson> pointsJson = layoutJson.getCoordinates(); // 
> code never reaches this point
>         UiFlag.flagNull("pointsJson", pointsJson);
>         ArrayList<Point> coordinates = new ArrayList<>();
>         UiFlag.flag(coordinates.toString());
>     }
> }
>
> the call is kicked off like this
>    EntityFisher fisher = new EntityFisher();
>    fisher.fish(id);
>
> I see everything done correctly on the server side and the JSON
> {"coordinates":[{"x":100,"y":90,"z":0,"index":0,"time":1478546404606},{"x"
> :118,"y":121,"z":0,"index":1,"time":1478547002023},{"x":154,"y":121,"z":0,
> "index":2,"time":1478547079871}]}
> is sent back as expected but I keep getting the "Timeout while calling 
> http://localhost:8080/layouts/AVhARgXQW9-o1U_GgvJa"; on the client side. 
> When I make the request through GWT RequestBuilder (as a same origin 
> request) everything works good.
>
> Any idea what's wrong in the above code?
>
> I would appreciate any help.
> Thanks
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to