Empty Response From HTTP Request

1,563 views
Skip to first unread message

Nick Apperley

unread,
May 11, 2011, 6:14:19 PM5/11/11
to Google Web Toolkit
Using RequestBuilder I can successfully make a request to the
Glassfish 3.1 server I have setup. The server delivers REST web
services that involve HTTP GET and POST. Currently I am testing to see
if I can establish communication between the server and the GWT
client. What isn't working is getting the correct response for the
particular web service used (a HTTP GET).

In Firefox with the same web service used it receives the correct
response which is an XML file. This confirms that the web service is
working properly. What are the possible causes for an empty response
from a HTTP request with GWT?

A. Stevko

unread,
May 12, 2011, 1:09:06 PM5/12/11
to google-we...@googlegroups.com
Hi Nick,
Are you saying that the server response is empty or that RequestBuilder does not recognize the response?
If its the former, the server is not recognizing something in the request like the browser code headers.
If its the latter, then I would compare the content-type and formatting of the response with a benchmark response from the eclipse dev tool.
Either way, you'll need to get below just looking at the browser display to understand & diagnose the communication protocols. I suggest using a logging proxy server on your test bench to track what is coming and going. MS Fiddler works well on Windows.
---Stevko



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




--
-- A. Stevko
===========
"If everything seems under control, you're just not going fast enough." M. Andretti





Nick Apperley

unread,
May 12, 2011, 6:15:56 PM5/12/11
to Google Web Toolkit
Every time a request is made with RequestBuilder an empty response is
returned from the server. If the request is made using just the web
browser in an empty tab a non empty response is returned from the
server that is displayed directly (in Firefox). With the latter the
expected response is returned from the server.

After doing some further investigation on the issue it seems as though
the empty response could be caused by GWT's Same Origin Policy. The
web services are running on a different server from the GWT client.
What was suggested was to use JsonpRequestBuilder instead of
RequestBuilder to bypass the SOP problem. However that can only be
done if one can change the REST web services to return Json instead of
XML.

I have undertaken the suggestion but now have an entirely new problem
to content with. Timeouts are occurring every time a request is made
using JsonpRequestBuilder. I have checked to see that the URL is
correct, and have extended the timeout duration but still end up with
the same problem. What could cause a timeout to occur with doing a
request with JsonpRequestBuilder?

Nick Apperley

unread,
May 12, 2011, 7:25:56 PM5/12/11
to Google Web Toolkit
What is really weird is that the timeouts are occurring with making a
request via JsonRequestBuilder yet the Glassfish server has received
the request successfully. I have been digging through the Glassfish
server logs and found an identical set of entries for 2 requests that
were made (one from GWT client, the other from the web browser). What
isn't recorded in the logs is if the server has sent back a response,
and its content if it was sent.

Right now I do not know what is happening with the server responses.
Presumably a response is being sent back to the GWT client. At least a
response has been sent back for the request made by the web browser.

A. Stevko

unread,
May 13, 2011, 1:34:42 AM5/13/11
to google-we...@googlegroups.com
Can you at least see the size of the response like in an apache log file?
Try using FireBug's Net Panel to see the request/response size/duration.

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

Nick Apperley

unread,
May 13, 2011, 2:12:36 AM5/13/11
to Google Web Toolkit
All web services were returning json but not in a way that is treated
as jsonp for the GWT client. Once that was fixed no more timeouts
occurred for future requests. However there is now a bizarre issue
where the ArrayList that was populated in the defined onSuccess method
(for the AsyncCallback object) is now empty outside of the method
definition. How can that happen when no items have been removed from
the ArrayList? The ArrayList was defined outside of the object.

Nick Apperley

unread,
May 13, 2011, 5:36:00 PM5/13/11
to Google Web Toolkit
As it turns out AsyncCallback doesn't have a way to inform that it is
finished. Therefore anything that needs the proper results from the
request would need to be done in the AsyncCallback's onSuccess method.
Reply all
Reply to author
Forward
0 new messages