Tuesday, April 1, 2014

Using GWTTestCase to do integration testing on GWT-RPC calls

Hi,
 
I'm trying to create an integration test that checks if a GWT-RPC service is working with our integration test servers.
My initial thought was to just use a GWTTestCase and point the GWT-RPC ServiceDefTarget to the real server.
 
It did not work:

32 [JS executor for com.gargoylesoftware.htmlunit.WebClient@3afb2359] ERROR com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl - Job run failed with unexpected
RuntimeException: Wrapped java.lang.RuntimeException: No permitted "Access-Control-Allow-Origin" header.
net
.sourceforge.htmlunit.corejs.javascript.WrappedException: Wrapped java.lang.RuntimeException: No permitted "Access-Control-Allow-Origin" header.

 at net
.sourceforge.htmlunit.corejs.javascript.Context.throwAsScriptRuntimeEx(Context.java:1889)
 at com
.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest.doSend(XMLHttpRequest.java:681)
 at com
.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest.access0(XMLHttpRequest.java:94)
 at com
.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest$1.run(XMLHttpRequest.java:603)
 at net
.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:602)
 at net
.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)
 at com
.gargoylesoftware.htmlunit.javascript.background.JavascriptXMLHttpRequestJob.run(JavascriptXMLHttpRequestJob.java:36)
 at com
.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl.runSingleJob(JavaScriptJobManagerImpl.java:328)
 at com
.gargoylesoftware.htmlunit.javascript.background.DefaultJavaScriptExecutor.run(DefaultJavaScriptExecutor.java:162)
 at java
.lang.Thread.run(Thread.java:724)
Caused by:
java
.lang.RuntimeException: No permitted "Access-Control-Allow-Origin" header.
 
... 9 more
 
I tried using a Filter that sets the Access-Control-Allow-Origin header to *, but it does not seem to work.
Is there a better way to perform this kind of integration test with GWT code ? Or is there a way to disable this check in HtmlUnit ?
 

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment