Hi,
i want to use easyXDM for my GWT project and got the following
problem:
EasyXDM defines a global var called easyXDM. A regular request would
look like this:
var xhr = new easyXDM.Rpc(...)
xhr.request(...);
My GWT JSNI code is the following:
protected static native void testRequest()
/*-{
try {
alert('easyXDM: ' + JSON.stringify($wnd.easyXDM));
var xhr = new $wnd.easyXDM.Rpc({
'remote': 'http://127.0.0.1:12345/cors/
index.html'
}, {
'remote': {
'request': {}
}
});
xhr.request({
'url': 'http://127.0.0.1:12345/
MyCORSDocument.txt',
'method': 'GET'
}, function(response) {
$wnd.alert('success');
}, function(response) {
$wnd.alert('failure');
});
} catch(e) {
$wnd.alert('exception');
}
}-*/;
The problem is, that GWT knows easyXDM
(alert(JSON.stringify($wnd.easyXDM)); prints some code), but treats
easyXDM.Rpc as undefined (alert(JSON.stringify($wnd.easyXDM)); prints
'undefined').
The request results in an exception:
[INFO] [ERROR] Alert: easyXDM: {"version":"2.4.15.118","query":
{"xdm_p":"5","xdm_c":"default6547","xdm_e":"http://
192.168.56.162:51262"},"stack":{},"Debug":{"_deferred":[]},"DomHelper":
{},"Fn":{}}
[INFO] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed:
34.25 sec <<< FAILURE!
[INFO]
testBasicFunctionality_CORSAnnotation(net.vz.gwt.easyxdm.client.CORSTestGwt)
Time elapsed: 34.235 sec <<< ERROR!
[INFO] java.lang.RuntimeException: Remote test failed at
192.168.56.162 / Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:
1.9.0.19) Gecko/2010031422 Firefox/3.0.19
[INFO] at
com.google.gwt.junit.JUnitShell.processTestResult(JUnitShell.java:
1288)
[INFO] at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:
1408)
[INFO] at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:
1309)
[INFO] at com.google.gwt.junit.JUnitShell.runTest(JUnitShell.java:
653)
[INFO] at
com.google.gwt.junit.client.GWTTestCase.runTest(GWTTestCase.java:441)
[INFO] at junit.framework.TestCase.runBare(TestCase.java:134)
[INFO] at junit.framework.TestResult$1.protect(TestResult.java:110)
[INFO] at junit.framework.TestResult.runProtected(TestResult.java:
128)
[INFO] at junit.framework.TestResult.run(TestResult.java:113)
[INFO] at junit.framework.TestCase.run(TestCase.java:124)
[INFO] at
com.google.gwt.junit.client.GWTTestCase.run(GWTTestCase.java:296)
[INFO] at junit.framework.TestSuite.runTest(TestSuite.java:232)
[INFO] at junit.framework.TestSuite.run(TestSuite.java:227)
[INFO] at junit.framework.TestSuite.runTest(TestSuite.java:232)
[INFO] at junit.framework.TestSuite.run(TestSuite.java:227)
[INFO] at junit.framework.TestSuite.runTest(TestSuite.java:232)
[INFO] at junit.framework.TestSuite.run(TestSuite.java:227)
[INFO] at
org.codehaus.mojo.gwt.test.MavenTestRunner.doRun(MavenTestRunner.java:
105)
[INFO] at junit.textui.TestRunner.start(TestRunner.java:180)
[INFO] at
org.codehaus.mojo.gwt.test.MavenTestRunner.main(MavenTestRunner.java:
63)
[INFO] Caused by: java.lang.Exception:
com.google.gwt.core.client.JavaScriptException: (null): null
[INFO] at
com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:
248)
[INFO] at
com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:
136)
[INFO] at
com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
561)
[INFO] at
com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:
289)
[INFO] at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:
107)
[INFO] at
net.vz.gwt.easyxdm.client.CORSDispatcher.testRequest(CORSDispatcher.java)
[INFO] at
net.vz.gwt.easyxdm.client.CORSDispatcher.doXDMRequest(CORSDispatcher.java:
98)
[INFO] at
net.vz.gwt.easyxdm.client.CORSDispatcher.send(CORSDispatcher.java:71)
[INFO] at org.fusesource.restygwt.client.Method.send(Method.java:201)
[INFO] at
net.vz.gwt.easyxdm.client.CORSService_Generated_RestServiceProxy_.getExampleDto(CORSService_Generated_RestServiceProxy_.java:
75)
[INFO] at
net.vz.gwt.easyxdm.client.CORSTestGwt.testBasicFunctionality_CORSAnnotation(CORSTestGwt.java:
88)
[INFO] at
net.vz.gwt.easyxdm.client.__CORSTestGwt_unitTestImpl.doRunTest(__CORSTestGwt_unitTestImpl.java:
7)
[INFO] at junit.framework.TestCase.runTest(TestCase.java:62)
[INFO] at
com.google.gwt.junit.client.GWTTestCase.runBare(GWTTestCase.java:188)
[INFO] at
com.google.gwt.junit.client.GWTTestCase.__doRunTest(GWTTestCase.java:
129)
[INFO] at
com.google.gwt.junit.client.impl.GWTRunner.runTest(GWTRunner.java:389)
[INFO] at
com.google.gwt.junit.client.impl.GWTRunner.doRunTest(GWTRunner.java:
318)
[INFO] at com.google.gwt.junit.client.impl.GWTRunner.access
$9(GWTRunner.java:312)
[INFO] at com.google.gwt.junit.client.impl.GWTRunner
$TestBlockListener.onSuccess(GWTRunner.java:107)
[INFO] at com.google.gwt.junit.client.impl.GWTRunner
$InitialResponseListener.onSuccess(GWTRunner.java:63)
[INFO] at com.google.gwt.junit.client.impl.GWTRunner
$InitialResponseListener.onSuccess(GWTRunner.java:1)
[INFO] at
com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:
232)
[INFO] at
com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:
287)
[INFO] at com.google.gwt.http.client.RequestBuilder
$1.onReadyStateChange(RequestBuilder.java:395)
[INFO] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
[INFO] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
[INFO] at java.lang.reflect.Method.invoke(Method.java:597)
[INFO] at
com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
[INFO] at
com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
[INFO] at
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:
172)
[INFO] at
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:
337)
[INFO] at
com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:
218)
[INFO] at
com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:
136)
[INFO] at
com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
561)
[INFO] at
com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:
269)
[INFO] at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:
91)
[INFO] at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
[INFO] at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:220)
[INFO] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
[INFO] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
[INFO] at java.lang.reflect.Method.invoke(Method.java:597)
[INFO] at
com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
[INFO] at
com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
[INFO] at
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:
172)
[INFO] at
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:
292)
[INFO] at
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:
546)
[INFO] at
com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:
363)
[INFO] at java.lang.Thread.run(Thread.java:680)
[INFO] Caused by: java.lang.Exception:
com.google.gwt.core.client.JavaScriptException: (null): null
[INFO] at
com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:
248)
[INFO] at
com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:
136)
[INFO] at
com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
561)
[INFO] at
com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:
289)
[INFO] at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:
107)
[INFO] at
net.vz.gwt.easyxdm.client.CORSDispatcher.testRequest(CORSDispatcher.java)
[INFO] at
net.vz.gwt.easyxdm.client.CORSDispatcher.doXDMRequest(CORSDispatcher.java:
98)
[INFO] at
net.vz.gwt.easyxdm.client.CORSDispatcher.send(CORSDispatcher.java:71)
[INFO] at org.fusesource.restygwt.client.Method.send(Method.java:201)
[INFO] at
net.vz.gwt.easyxdm.client.CORSService_Generated_RestServiceProxy_.getExampleDto(CORSService_Generated_RestServiceProxy_.java:
75)
[INFO] at
net.vz.gwt.easyxdm.client.CORSTestGwt.testBasicFunctionality_CORSAnnotation(CORSTestGwt.java:
88)
[INFO] at
net.vz.gwt.easyxdm.client.__CORSTestGwt_unitTestImpl.doRunTest(__CORSTestGwt_unitTestImpl.java:
7)
[INFO] at junit.framework.TestCase.runTest(TestCase.java:62)
[INFO] at
com.google.gwt.junit.client.GWTTestCase.runBare(GWTTestCase.java:188)
[INFO] at
com.google.gwt.junit.client.GWTTestCase.__doRunTest(GWTTestCase.java:
129)
[INFO] at
com.google.gwt.junit.client.impl.GWTRunner.runTest(GWTRunner.java:389)
[INFO] at
com.google.gwt.junit.client.impl.GWTRunner.doRunTest(GWTRunner.java:
318)
[INFO] at com.google.gwt.junit.client.impl.GWTRunner.access
$9(GWTRunner.java:312)
[INFO] at com.google.gwt.junit.client.impl.GWTRunner
$TestBlockListener.onSuccess(GWTRunner.java:107)
[INFO] at com.google.gwt.junit.client.impl.GWTRunner
$InitialResponseListener.onSuccess(GWTRunner.java:63)
[INFO] at com.google.gwt.junit.client.impl.GWTRunner
$InitialResponseListener.onSuccess(GWTRunner.java:1)
[INFO] at
com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:
232)
[INFO] at
com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:
287)
[INFO] at com.google.gwt.http.client.RequestBuilder
$1.onReadyStateChange(RequestBuilder.java:395)
[INFO] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
[INFO] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
[INFO] at java.lang.reflect.Method.invoke(Method.java:597)
[INFO] at
com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
[INFO] at
com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
[INFO] at
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:
172)
[INFO] at
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:
337)
[INFO] at
com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:
218)
[INFO] at
com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:
136)
[INFO] at
com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
561)
[INFO] at
com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:
269)
[INFO] at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:
91)
[INFO] at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
[INFO] at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:220)
[INFO] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
[INFO] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
[INFO] at java.lang.reflect.Method.invoke(Method.java:597)
[INFO] at
com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
[INFO] at
com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
[INFO] at
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:
172)
[INFO] at
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:
292)
[INFO] at
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:
546)
[INFO] at
com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:
363)
[INFO] at java.lang.Thread.run(Thread.java:680)
I appreciate any 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 [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.