I've committed some changes to 2.7.x:

- XmlType only annotated classes should now be processed as expected,
the schema elements will be added in addition to what JAXB compiler generates, and the references from WADL reps to these elements should be visible - @XMLName is not needed unless default XmlType processing needs to be customized

- added a WadlGenerator constructor accepting a Bus - this should help with loading the external resources not visible to the default loader/resolver, in case you'd like to reuse the existing schema resources

Give it a try please when you get a chance,
Sergey

On 10/10/13 15:20, David Karlsen wrote:
No - I had it like this:
  <bean class="org.apache.cxf.jaxrs.model.wadl.WadlGenerator">
                                 <property
name="useJaxbContextForQnames" value="true" />
                                 <property
name="addResourceAndMethodIds" value="true" />
                         </bean>

I've tried to:
<bean class="org.apache.cxf.jaxrs.model.wadl.WadlGenerator">
<property name="useJaxbContextForQnames" value="true" />
<property name="addResourceAndMethodIds" value="true" />
<property name="schemaLocations">
<list>
<value>/xsd/common-v1.xsd</value>
........ additional schemas....
</list>
</property>
</bean>

also xsd/common-v1.xsd
or
classpath:xsd/common-v1.xsd

none of them are able to find the schema:
2013-10-10 16:00:26,113 [main][][][][][][][] WARN
org.apache.cxf.jaxrs.model.wadl.WadlGenerator - No schema resource
/xsd/common-v1.xsd can be loaded : null


the schemas are in another jarfile on the classpath - so not in the .war
which contains cxf-servlet.xml which contains the above wadlgenerator config


2013/10/10 Sergey Beryozkin <[email protected]
<mailto:[email protected]>>

    Hi David

    I'm doing some work on it, following our conversation on IRC.
    Let me double check one thing, do you configure WADLGenerator with
    the list of schemas to be included in the grammar section ?

    If not then WADLGenerator may have to create xsd:elements somehow
    itself, similarly to the way it does it for explicit collections
    like List<Book>, because JAXB won't generate itself xsd:element from
    @XmlType only

    Cheers. Sergey


    On 08/10/13 09:34, David Karlsen wrote:

        OK - been experimenting a little - it's due to missing
        XmlRootElement
        annotations.

        If I "inline" the type definition it will work.
        This works:
        <element name="customerCreateRequest">
        <complexType>
        <annotation>
        <documentation>
        Create a new distinct customer.
        Customers have distinct customerIds within an organization.
        </documentation>
        </annotation>
        <sequence>
        <element name="customer" type="customer:customerType" />
        </sequence>
        </complexType>
        </element>

        instead of the more reusable (will not work):
        <element name="customerCreateRequest"
        type="tns:__customerCreateRequest">


        <complexType name="customerCreateRequest">
        <annotation>
        <documentation>
        Create a new distinct customer.
        Customers have distinct customerIds within an organization.
        </documentation>
        </annotation>
        <sequence>
        <element name="customer" type="customer:customerType" />
        </sequence>
        </complexType>


        Is there no way around this?

        I thought that was what @XmlName was for.



        2013/10/7 David Karlsen <[email protected]
        <mailto:[email protected]>>

            Hi.

            I did this:
            @POST
                  @Consumes( { MediaType.APPLICATION_XML} )
                  @Produces( { MediaType.APPLICATION_XML } )
                  public void testCreate( @XMLName( value =
            
"{urn:srv.jfr.tac.fs.edb.com:w__s:customer:v1}__customerCreateRequest"
            ) CustomerCreateRequest customerCreateRequest ) {

            And have also cleaned up the config.


            2013/10/7 Sergey Beryozkin <[email protected]
            <mailto:[email protected]>>

                Hi David

                On 07/10/13 10:54, David Karlsen wrote:

                    Hi.

                    I have an existing jax-ws service that I now
                    additionally want to expose
                    as
                    a REST/jax-rs service.
                    I've configured it like this:
                    *http://pastebin.com/h7cy8ZYB *
                    The wadl generated looks like:
                    *http://pastebin.com/QQRbNb3n *

                    I would expect it to refer to the request /response
                    types not to look
                    like
                    <representation mediaType="application/xml"/>

                    but rather something like:
                    <representation mediaType="application/xml"
                    type="tns:**__customerCreateRequest" />


                    I've tried adding @XmlName etc but nothing changes.


                I suspect the reason you don't have the proper mappings
                generated is that
                the JAX-WS generated code has the bean parameters with
                JAXB XMLType only
                and the JAX-RS runtime does wrap/unwrap the types.

                How do you use XMLName ? It needs to contain extended
                QNames, example "{
                http://myns}MyRootElement";.

                As a side note, the configuration can be simplified:
                - two conflicting JAXB providers, need to drop either
                jaxrs:dataBinding
                or JAXBProvider,
                - two Jackson providers, I'm not sure which one will
                work better in your
                case, please try
                - re the schema validation, you need to get that schema
                list set up only
                once, using SchemaHandler makes sense only if you reuse
                it between CXF JAXB
                and JSON providers, but you don't, so drop it; next , if
                you decide to keep
                JAXBProvider then drop jaxrs:schemaLocations

                Cheers, Sergey





                    Any hints?

                    --
                    David J. M. Karlsen -
                    http://www.linkedin.com/in/**__davidkarlsen
                    
<http://www.linkedin.com/in/**davidkarlsen><http://www.__linkedin.com/in/davidkarlsen
                    <http://www.linkedin.com/in/davidkarlsen>>





            --
            --
            David J. M. Karlsen -
            http://www.linkedin.com/in/__davidkarlsen
            <http://www.linkedin.com/in/davidkarlsen>






    --
    Sergey Beryozkin

    Talend Community Coders
    http://coders.talend.com/

    Blog: http://sberyozkin.blogspot.com




--
--
David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen


--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to