views:

354

answers:

2

I am trying to use GWT to build objects on the client side that would be sent to a web service elsewhere. These objects are generate through JAX-WS which I am pretty sure uses jaxb to build objects from the xsds that are in the wsdl.

Anyhow, GWT was supposed to be able to support this by ignoring annotations or whatever, but it isn't working for me. Here is one of the errors that I am getting:

Line 4: The import javax.xml.bind cannot be resolve

I am using GWT 2 and the Google plugin for Eclipse.

+1  A: 

If I am correct you cannot use that library on the client side... That's why you get the exception.

You can find a list of packages that are available for use at the following location. http://code.google.com/webtoolkit/doc/latest/RefJreEmulation.html

markovuksanovic
+1  A: 

You can use your generated JAXB objects on the client if you include the source files from the javax.xml.bin.annotation package in your GWT compile path. You may need to include a few source files from javax.xml.bind and javax.xml.bind.annotation.adapters as well to get it to compile.

Joel
Are you sure this would work? I'm not sure that would work as expected because GWT cannot emulate that package...
markovuksanovic
Yes, I do this and I've seen on the GWT google group that others do as well. Its true that GWT doesn't emulate JAXB which is why you need to provide the source files. The JAXB source files you need to include don't rely on anything GWT can't emulate. If you included all the JAXB source you would run into problems.
Joel
Yeah, i guess you could do it as described here but it seems to be risky. Here is an explanation found in GWT groups - GWT Java code is compiled into Javascript and run inside the browser container. That container has many "rules" that it must follow. And a lot of real basic feeling functionality (like writing to the file system for example) are not allowed.
markovuksanovic