Hi,

This is about GWT 1.7.1 on a RedHat EL 5.4 system.

I have been messing with GWT for a while now.  I am not an expert and
am really still a java newbie.  I have the following code snippet
in an application I am writing.  There is an existing CGI app and
I am replacing the GUI with GWT and using the existing CGI scripts
for the data operations.

I am setting up a RequestBuilder call to retrieve data from a CGI
script.  That script generates data and sends it as a JSON string back
to this routine.  The issue is that I am receiving an:

    empty argument

message that is generated by the JSONParser.  The message comes
through the catch clause that holds the

    LOG("getInfo:onResponseReceived:e2:"

line.

I *know* the CGI script is doing its thing.  I can run it from the
command line and visit its URL and I get JSON'd data that looks OK
to my eye.  The code section looks like:


    public void getInfo() {
        RequestBuilder req;
        LOG("getInfo:a");

        req = new RequestBuilder(RequestBuilder.GET,
                                 URL.encode(baseURL + "archive.cgi"));

        LOG("getInfo:b:"+req.getUrl());

        try {
            req.sendRequest(null, new RequestCallback() {
                public void onError(Request request, Throwable e) {
                    Window.alert("getInfo failed: " + e.toString());
                }

                public void onResponseReceived(Request request,
                                               Response response) {
                    JSONObject Info;
                    try {
                        LOG("getInfo:onResponseReceived:a:");
                        Info = JSONParser.parse(response.getText()
                                                           ).isObject
();
                    }
                    catch (NullPointerException e) {
                        LOG("getInfo:onResponseReceived:e1:" +
                             e.getMessage());
                        throw new RuntimeException(
                                         "Failed to send JSON
request");
                    }
                    catch(IllegalArgumentException e) {
                        LOG("getInfo:onResponseReceived:e2:" +
                            e.getMessage());
                        throw new RuntimeException(
                                         "Failed to send JSON
request");
                    }
                    catch(Exception e) {
                        LOG("getInfo:onResponseReceived:e3:" +
                            e.getMessage());
                        throw new RuntimeException(
                                         "Failed to send JSON
request");
                    }


Here is a sample JSON'd string.

{"searchTerm":"","pending":["<h2>Calendar for Fall 2009</h2>
\n","<h3>Tuesday, November 10, 2009<br/>MRI Stuff</h3>\n<h4>Speaker:
Andrew <a href=\"mailto:and...@north.com\";><img src=\"/images/email.jpg
\" alt=\"(email)\"/></a>, Radiology and Biomedical Engineering</h4>
\n<h4>Time: 12:00PM</h4>\n<h4>Location: Room 5602</h4>\n<h4>Abstract:</
h4>\n<p>Transcatheter and percutaneous liver-directed approaches are
widely used for the treatment of ... procedures.</p>\n","<h3>Tuesday,
November 17, 2009<br/>Title Forthcoming</h3>\n<h4>Speaker: Chas
Conway</h4>\n<h4>Time: 12:00PM</h4>\n<h4>Location: </h4>
\n<h4>Abstract:</h4>\n<p>Abstract Forthcoming</p>\n","<h3>Tuesday,
November 24, 2009\n<br/>No Forum - Thanksgiving Vacation</h3>
\n","<h3>Tuesday, December 1, 2009<br/>Title Forthcoming</h3>
\n<h4>Speaker: Yi Lu, Professor</h4>\n<h4>Time: 12:00PM</h4>
\n<h4>Location: </h4>\n<h4>Abstract:</h4>\n<p>Abstract Forthcoming</p>
\n","<h3>Tuesday, December 8, 2009<br/>Title Forthcoming</h3>
\n<h4>Speaker: </h4>\n<h4>Time: 12:00PM</h4>\n<h4>Location: </h4>
\n<h4>Abstract:</h4>\n\n","<h3>2009-12-09<br/>Fall Semester Ends</h3>
\n"]}


This was produced from a Perl cgi script using CGI.pm and JSON::XS


FireFox/FireBug shows the request call and the headers but the result
is missing.

This code is not really different than other working code and the
CGI is not really all that different either.

I have tried using a POST method and setting

    req.setHeader("Content-Type", "application/x-www-form-
urlencoded");

though I am not "sending" any data to the script.

I have tried setting

    req.sendRequest(null, new RequestCallback() {
    req.sendRequest("", new RequestCallback() {
    req.sendRequest("dummy=value", new RequestCallback() {

and it is still happening.

It must be something very trivial that I am not seeing.  Can you help?

--~--~---------~--~----~------------~-------~--~----~
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-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to