You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Paul Lowry <pl...@progress.com> on 2010/05/26 19:54:53 UTC
Advice re generating JAX-B and JAX-WS annotations
Hi,
I am trying to expose several plain Java interfaces as web services, using CXF / java2ws / wsdl2java.
My original plan was to...
(1) use java2ws generate WSDL and XSD files from the existing POJO classes
(2) use wsdl2java to generate new Java sources containing JAX-WS and JAX-B annotations
(3) implement web services using these generated files
However, I found that there are many types missing from the generated XSD files, because they are not included in the JAX-B mapping.
http://java.sun.com/javaee/5/docs/tutorial/doc/bnazq.html#bnazw
So I adjusted my plan...
(1) use java2ws generate WSDL and XSD files from the existing POJO classes
(2) modify the generated XSD files by hand, to include XML representations of the unsupported Java types
(3) write a JAX-B binding extensions XML file, so that wsdl2java would know how to handle the additional types
(4) use wsdl2java to generate new Java sources containing JAX-WS and JAX-B annotations
(5) implement web services using these generated files
However, now I hear that the JAX-B mapping does not (yet) support any representation of java.util.Map, which is one of the types in my original POJO files.
http://stackoverflow.com/questions/1881712/is-it-possible-to-use-jaxb-to-map-from-schema-to-a-java-util-map
So please tell me:
- is there any way I can do this, which involves modifying the output of java2ws, or extending the capabilities of java2ws and wsdl2java?
- or... must I add JAX-B annotations to the original Java files? is there any tool that might speed up this painstaking work?
- or... can you suggest an alternative approach?
Thanks & Regards,
Paul
Re: Advice re generating JAX-B and JAX-WS annotations
Posted by Christian Schneider <ch...@die-schneider.net>.
Hi Paul,
could you send the java code you create the wsdl from. I could imagine
that you use inheritance. That was one point where stuff was missing
when I did the same.
If this is the problem then you can hint the generator what the
implementations are that you want to include in the wsdl.
Greetings
Christian
Am 26.05.2010 19:54, schrieb Paul Lowry:
> Hi,
>
> I am trying to expose several plain Java interfaces as web services, using CXF / java2ws / wsdl2java.
>
> My original plan was to...
>
> (1) use java2ws generate WSDL and XSD files from the existing POJO classes
>
> (2) use wsdl2java to generate new Java sources containing JAX-WS and JAX-B annotations
>
> (3) implement web services using these generated files
>
> However, I found that there are many types missing from the generated XSD files, because they are not included in the JAX-B mapping.
> http://java.sun.com/javaee/5/docs/tutorial/doc/bnazq.html#bnazw
>
> So I adjusted my plan...
>
> (1) use java2ws generate WSDL and XSD files from the existing POJO classes
>
> (2) modify the generated XSD files by hand, to include XML representations of the unsupported Java types
>
> (3) write a JAX-B binding extensions XML file, so that wsdl2java would know how to handle the additional types
>
> (4) use wsdl2java to generate new Java sources containing JAX-WS and JAX-B annotations
>
> (5) implement web services using these generated files
>
> However, now I hear that the JAX-B mapping does not (yet) support any representation of java.util.Map, which is one of the types in my original POJO files.
> http://stackoverflow.com/questions/1881712/is-it-possible-to-use-jaxb-to-map-from-schema-to-a-java-util-map
>
> So please tell me:
>
> - is there any way I can do this, which involves modifying the output of java2ws, or extending the capabilities of java2ws and wsdl2java?
>
> - or... must I add JAX-B annotations to the original Java files? is there any tool that might speed up this painstaking work?
>
> - or... can you suggest an alternative approach?
>
> Thanks& Regards,
> Paul
>
>
>
--
----
http://www.liquid-reality.de
Re: Advice re generating JAX-B and JAX-WS annotations
Posted by Daniel Kulp <dk...@apache.org>.
On Wednesday 26 May 2010 1:54:53 pm Paul Lowry wrote:
> Hi,
>
> I am trying to expose several plain Java interfaces as web services, using
> CXF / java2ws / wsdl2java.
>
> My original plan was to...
>
> (1) use java2ws generate WSDL and XSD files from the existing POJO
> classes
>
> (2) use wsdl2java to generate new Java sources containing JAX-WS and
> JAX-B annotations
>
> (3) implement web services using these generated files
>
> However, I found that there are many types missing from the generated XSD
> files, because they are not included in the JAX-B mapping.
> http://java.sun.com/javaee/5/docs/tutorial/doc/bnazq.html#bnazw
>
> So I adjusted my plan...
>
> (1) use java2ws generate WSDL and XSD files from the existing POJO
> classes
>
> (2) modify the generated XSD files by hand, to include XML
> representations of the unsupported Java types
>
> (3) write a JAX-B binding extensions XML file, so that wsdl2java would
> know how to handle the additional types
>
> (4) use wsdl2java to generate new Java sources containing JAX-WS and
> JAX-B annotations
>
> (5) implement web services using these generated files
>
> However, now I hear that the JAX-B mapping does not (yet) support any
> representation of java.util.Map, which is one of the types in my original
> POJO files.
> http://stackoverflow.com/questions/1881712/is-it-possible-to-use-jaxb-to-m
> ap-from-schema-to-a-java-util-map
>
> So please tell me:
>
> - is there any way I can do this, which involves modifying the
> output of java2ws, or extending the capabilities of java2ws and wsdl2java?
Probably not.
> - or... must I add JAX-B annotations to the original Java files?
> is there any tool that might speed up this painstaking work?
Well, the only things you need to annotate are the areas where the stuff that
isn't generated isn't exactly what you want. The MAIN issue will be the Maps
and anything else that uses an interface instead of an actual bean. Those
will also require an XmlJavaTypeAdapter thing to be created to map the
unsupported types into types that are supported.
> - or... can you suggest an alternative approach?
Define the wsdl contract first, generate code and use the newly generated code
and check all the old stuff? ;-)
--
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog