I’d like to read in an XML file that is stored on my Tomcat server in a different location than my GWT project. How is this easily accomplished? Should I be making Remote Procedure Calls? Maybe retrieving JSON data via HTTP? I saw this page but am not sure if this is the solution to my problem or if something like RPCs is making this more difficult than it needs to be. I’m a newb, so please steer me in the right direction if I’m going about this all wrong.
I have also looked at this page, which explains how to parse the XML file. I understand the parsing, but I’m having trouble figuring out how to get the XML file off of the server in the first place. I’ve tried this:
try {
new RequestBuilder(RequestBuilder.GET,
"http://localhost:8180/Videos/testFile.xml").
sendRequest("", new RequestCallback() {
@Override
public void onResponseReceived(Request req, Response resp) {
String text = resp.getText();
// This method parses the XML file, but is never getting any data to parse
parseMessage(text);
}
@Override
public void onError(Request res, Throwable throwable) {
// handle errors
System.out.println("Error occurred");
}
});
} catch (RequestException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
But when I try this, parseMessage(text) never gets any data to parse, it just gets an empty string.
Try this:
If you’re still experiencing problems, start debugging the response.