To handle the response you have a few options:

1. GWT JS Overlay Types (
http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsOverlay.html
)

You can read the JSON response and pretty easily map it to the JS Overlay
Type you've defined describing the JSON structure.

2. GWT AutoBean (http://code.google.com/p/google-web-toolkit/wiki/AutoBean)

Similar as 1) above, just even cooler. At least for me :)

Your comment:

"in GWT it returns a status code 0" ...

You are running into the SOP (Same Origin Policy) here.

There are a couple of alternatives:

a)
http://google-web-toolkit.googlecode.com/svn/javadoc/2.4/com/google/gwt/jsonp/client/JsonpRequestBuilder.html

b) You can send the call to your server (running on the same domain, making
sure you don't violate none of the SOP rules, different port,etc..) and
from there send a call to your remote server.

c) You can load the test data from your domain backend server and then test
from there so you don't run into the SOP issue using either 1) or 2)
mentioned above.

There are might be other options, those come to mind right now.

Regards,

Alfredo


On Sat, Dec 3, 2011 at 8:54 AM, CSchulz <[email protected]> wrote:

> I'm wondering if there's a way to have a json file, hosted locally or
> online, where I can create a bunch of test data and then load it into my
> GWT app and parse it like a RequestBuilder call. I've been looking online
> for a way to do this and nothing seems to work. I then tried putting
> together a php script to return some json, and even though it works in the
> browser and returns a 200 status code in my Charles web proxy, in GWT it
> returns a status code 0 and doesn't give me any data. The php file was not
> hosted locally and I have the php content type set to application/json.
> If there's another way to load this json that would be nice. I don't want
> to have to create these json objects from scratch in GWT.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-web-toolkit/-/TMv9iuNq82MJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>



-- 
Alfredo Quiroga-Villamil

AOL/Yahoo/Gmail/MSN IM:  lawwton

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to