Hello All,

After looking to couple of examples. I figured out it's not actually cross
domain causing the issue, but "parsing" the JSON response.

Here are 2 formats i got from public APIs

A. http://twitter.com/statuses/user_timeline/twitter.json?callback=callback1

B.
http://ws.geonames.org/postalCodeLookupJSON?postalcode=94107&country=US&callback=callback1

I am using JavaScriptObject to store JSON response.

handleJson(ILcom/google/gwt/core/client/JavaScriptObject;)(requestId,jsonObj);

So far so good :-).

Now, I am casting JavaScriptObject to JsArray.

Then, To read element values from JSON.

For A, public final native String getText() /*-{return this.text}-*/;

For B, I have : public final native String getPlaceName() /*-{ return
this.placeName;  }-*/;


I could get expected results with  getText(). (which reads "text" from JSON
response)

Tried getPlaceName()  for B, unfortunately, the Method returns null.

I think i am not parsing JSON response for B properly.

Reponse for A  :

*callback1(*[{"truncated":false,"coordinates":null,"source":"web","created_at":"Thu
Jul 22 00:09:23 +0000 2010","in_reply_to_screen_name":null,"text":"Twitter
blog post on the service's reliability (w/ links to longer, more technical
explanations): http://bit.ly/9KuyG9

Response for B:

*callback1({"postalcodes":*[{"adminName2":"San
Francisco","adminCode2":"075","postalcode":"94107","adminCode1":"CA","countryCode":"US","lng":-122.397099,"placeName":"San
Francisco","lat":37.762147,"adminName1":"California"}]});

Only different is Reponse B is extraelment "postalcodes".

Looks like "postalcodes" element not letting JsArray parse JSON response
properly.

*I will buy you a beer if you could help me with parsing Response B ;-)*

Cheers,
V M.

On Thu, Jul 22, 2010 at 11:20 AM, rajendra dasari
<[email protected]>wrote:

> Yah I am working on cross site communication using JSON, we are passing
> response from server
> using JSON response, and getting from client  as JSON objects.
>
> --
>
> Raj.
>
>
> On Wed, Jul 21, 2010 at 5:39 AM, VM <[email protected]> wrote:
>
>> Hello GWT Users,
>>
>> I just wanted to check if anybody had success with Cross domain
>> communication.
>>
>> I followed Google documentation:
>>
>> http://code.google.com/webtoolkit/doc/latest/tutorial/Xsite.html
>>
>> [email protected]
>> ::handleJsonResponse(Lcom/
>> google/gwt/core/client/JavaScriptObject;)(jsonObj);
>>
>> handleJsonResponse is not getting called.
>>
>> Any thoughts?
>>
>> --
>> 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]<google-web-toolkit%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-web-toolkit?hl=en.
>>
>>
>  --
> 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]<google-web-toolkit%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>

-- 
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