users@jaxb.java.net

Re: question on Annotate Plugin

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Fri, 14 Jan 2011 08:33:20 +0100

Hi,

> I tried using the Annotate Plugin, and it’s great work. I used it to
> generate annotations from .xsd files, and it’s very convenient. Now I got a
> question – we’d like to generate annotations for operations in .wsdl files.
> Can I use Annotate Plugin to do it? If so, do you have samples on how to do
> it? Thanks in advance.

Yes, this must be possible, but I don't have samples at the moment.
You can definitely put annotating XML fragments in binding files and
as far as I know, you can use bindings for WSDL as well.

Here's an example of project which uses JAXB bindings for WSDL:

http://java.net/projects/hj3/sources/svn/show/trunk/ejb/samples/customerservice-cxf

I'd expect a sample bindings file to be like (a mixture from jaxws and
jaxb bindings):

<jaxws:bindings
        wsdlLocation="CustomerService.wsdl"
        xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

        <jaxws:bindings node="wsdl:definitions/wsdl:types/xs:schema">
                <jaxb:bindings
node="xsd:complexType[@name='OneType']/xsd:sequence/xsd:element[@name='b']">
                        <annox:annotate>
                                <annox:annotate
annox:class="org.jvnet.jaxb2_commons.plugin.annotate.test.annox.annotations.Alpha"
longField="-1" enumField="SIX" stringField="seven">
                                        <annox:annotate annox:field="intField">0</annox:annotate>
                                        <annox:annotate annox:field="shortField">3</annox:annotate>
                                </annox:annotate>
                        </annox:annotate>
                </jaxb:bindings>
        </jaxws:bindings>
</jaxws:bindings>

(This is a mock, things like "annotate" namespace and
jaxb:extensionBindingPrefixes are missing.)

Hope this help.

Bye,
/lexi