JAXB & GWT How I can use JAXB generated classes on client side

1,478 views
Skip to first unread message

Alberto Rugnone

unread,
Jul 14, 2010, 11:29:16 AM7/14/10
to Google Web Toolkit
Hi all,
I have to use classes with jaxb annotation on client side, but GWT
compiler refuse to work throwing following exception

No source code is available for type javax.xml.namespace.QName
No source code is available for type javax.xml.bind.JAXBElement<T>

etc...

someone can help me

Thank you very much in advanced

Shyam Visamsetty

unread,
Jul 14, 2010, 8:57:59 PM7/14/10
to Google Web Toolkit
I think you cannot use JAXB with GWT. JAXB uses a lot of classes which
GWT cant compile. So, you may not be able to use it. You can use the
standard xml packages that come with GWT.

Thanks,
Shyam Visamsetty.

On Jul 14, 8:29 am, Alberto Rugnone <arugnonechemi...@gmail.com>
wrote:

Frederic Conrotte

unread,
Jul 15, 2010, 2:27:52 AM7/15/10
to Google Web Toolkit

chris

unread,
Jul 15, 2010, 10:27:55 AM7/15/10
to Google Web Toolkit
Thank you for the advice and it appears that this would work for
server but not for client marshalling. I have been investigating a way
to use JAXB to marshall soap requests on the client side but have not
found a way as of yet. I would love to get rid of soap all together
but unfortunately that will not be possible. Has anyone found a way to
marshall the POJO to XML on the client?

Thanks,
Chris Hinshaw

On Jul 15, 1:27 am, Frederic Conrotte <frederic.conro...@gmail.com>
wrote:
> There is no problem in using JAXB along with GWT.
>
> See this thread for explanations:http://code.google.com/p/google-web-toolkit/issues/detail?id=4020&q=J...

chris

unread,
Jul 15, 2010, 10:27:44 AM7/15/10
to Google Web Toolkit
Thank you for the advice and it appears that this would work for
server but not for client marshalling. I have been investigating a way
to use JAXB to marshall soap requests on the client side but have not
found a way as of yet. I would love to get rid of soap all together
but unfortunately that will not be possible. Has anyone found a way to
marshall the POJO to XML on the client?

Thanks,
Chris Hinshaw

On Jul 15, 1:27 am, Frederic Conrotte <frederic.conro...@gmail.com>
wrote:
> There is no problem in using JAXB along with GWT.
>
> See this thread for explanations:http://code.google.com/p/google-web-toolkit/issues/detail?id=4020&q=J...

lineman78

unread,
Jul 15, 2010, 12:40:14 PM7/15/10
to Google Web Toolkit
It is not possible to convert POJO to XML without using some sort of
library, but Jersey does have the ability to do JSON. I use JAXB to
generate my server side classes and JAX-RS to marshal to XML and JSON
depending on the Accepts header. This is fairly easy to do using a
services context resolver annotated with provider and consumes/
produces application/json. I then have written a generator(no I can't
provide it, but it is possible) so that I can write an interface for a
POJO and it will generate the overlay type for me, but if you are
working on a smaller project manually writing the overlay types is the
best solution.

David Vree

unread,
Jul 15, 2010, 2:10:33 PM7/15/10
to Google Web Toolkit
I don't want to hijack your thread, but I am new to this and am
wondering why you don't use GWT-RPC to do the client/server
communication?

lineman78

unread,
Jul 15, 2010, 2:21:53 PM7/15/10
to Google Web Toolkit
Personally, I prefer to use Jersey vs GWT RPC because it is more
flexible and exposes standard interfaces. For instance, in our group
there are both Java and C# guys, so if our webservices have the
ability to support multiple standards everyone can use them. I have
Jersey set up so that depending on the Accept header it will serve
your either XML, JSON or Java serialization. Also, with very little
work I can also create SOAP services. I think GWT-RPC is a very nice
protocol and is nice for people on small project or don't have to
worry about flexability or external interfaces and have complete
control of all design decisions in their project, but when you are
working in large groups where you don't always have a say in all
potential interfaces, then it is better to just use open standards. I
have done a few personal GWT projects where I have used RPC, so I am
not against it by any means.

chris

unread,
Jul 16, 2010, 10:56:50 AM7/16/10
to Google Web Toolkit
I would love to use gwt-rpc for this application but the server side
is an embedded device with only apache and gsoap. I have done this
once for another embedded system using rocket-gwt json serialization
and wrote a backend cgi exec that would unmarshall using json-c to c
structs. But this has a soap service with over 150 separate soap
calls. I guess I am looking for a way to do xml serialization client
side and that is not going to be possible without writing my own
library. It would probably be possible though with some custom
annotations and deferred binding simlilar to what rocket-gwt does but
I have not found such a library. Maybe I will take a stab at it when I
get some time.

Thanks for the advice,
Chris
Reply all
Reply to author
Forward
0 new messages