I created a simple web application with GWT + GAE with a Java backend (pretty much similar to the drive example in the tutorial: http://www.gwtproject.org/doc/latest/tutorial/clientserver.html ). It works great when servicing a .appspot.com domain.
I would like to be able to serve part of the client (GWT) from another server (the local web server on my PC) and still use GAE as a backend. How can I do that?
Attempt to solve
I understand that this adds to the implementation of the Ajax cross server, I did not find much information on how to do this, so I continued trial and error; here is what i did:
The client application is called myapp_web , the server side is called myapp.
I copied the GWT part to my local server in the directory / webapps / myapp_web ; It is loaded perfectly. I got a 404 error on / webapps / myapp_web / myapp , so I realized that this is the URL where the application is trying to find the backend.
I found in http://developer.yahoo.com/javascript/howto-proxy.html an example PHP script that should serve as a proxy server that allows a cross server:
<?php // PHP Proxy example for Yahoo! Web services. // Responds to both HTTP GET and POST requests // // Author: Jason Levitt // December 7th, 2005 // // Allowed hostname (api.local and api.travel are also possible here) define ('HOSTNAME', 'http://search.yahooapis.com/'); // Get the REST call path from the AJAX application // Is it a POST or a GET? $path = ($_POST['yws_path']) ? $_POST['yws_path'] : $_GET['yws_path']; $url = HOSTNAME.$path; // Open the Curl session $session = curl_init($url); // If it a POST, put the POST data in the body if ($_POST['yws_path']) { $postvars = ''; while ($element = current($_POST)) { $postvars .= urlencode(key($_POST)).'='.urlencode($element).'&'; next($_POST); } curl_setopt ($session, CURLOPT_POST, true); curl_setopt ($session, CURLOPT_POSTFIELDS, $postvars); } // Don't return HTTP headers. Do return the contents of the call curl_setopt($session, CURLOPT_HEADER, false); curl_setopt($session, CURLOPT_RETURNTRANSFER, true); // Make the call $xml = curl_exec($session); // The web service returns XML. Set the Content-Type appropriately header("Content-Type: text/xml"); echo $xml; curl_close($session); ?>
I copied this script to / webapps / myapp_web / myapp, the myapp file, without the extension, and I got Apache to handle it as php. I changed the HOSTNAME variable from http://search.yahooapis.com/ to <a3> .
Now I get 500 server errors and I am stuck not knowing how to debug this. Thanks for any help you can provide.