Hi

The problem is that JAXB compiler does not generate "base.A".
So I guess this is where 'tMap' can become handy.

Does anyone know how to cause JAXB generate classes in cases like

"<element name="A" type="nsbase:AType" />",

example, 'A' class has to be generated too, in addition to 'AType'

Sergey

On 15/10/12 12:54, Mickael Marrache wrote:
Hi,

The complete WADL:

<?xml version="1.0"?>
<application xmlns="http://wadl.dev.java.net/2009/02";
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
       xmlns:nsbase="urn:base" xmlns:nsrest="urn:rest"
       xsi:schemaLocation="http://wadl.dev.java.net/2009/02 
http://www.w3.org/Submission/wadl/wadl.xsd";>

      <grammars>  
        <schema xmlns="http://www.w3.org/2001/XMLSchema"; xmlns:nsbase="urn:base"
                xmlns:nsrest="urn:rest " targetNamespace="urn:rest">
                <import namespace="urn:base"
                                schemaLocation="myschema.xsd" />
                        
                <element name="A" type="nsbase:AType" />
        </schema>
     </grammars>

     <resources base="REPLACE_WITH_THE_BASE_URL">
        <resource id="AResource" path="/A/{id}">
        <method id="saveA" name="PUT">
                            <request>
                                 <representation mediaType="application/xml" 
element="nsrest:A" />
                            </request>
                            <response status="200"/>
                      </method>
               </resource>
    </resources>
</application>

My schema:

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns:nsbase="urn:base " xmlns="http://www.w3.org/2001/XMLSchema";
        targetNamespace="urn:base"
        elementFormDefault="qualified" xml:lang="EN">

         <complexType name="BType" abstract="true">
        <sequence>
        <element name="b1" type="string" />
        </sequence>
         </complexType>

       <complexType name="AType">
             <complexContent>
                   <extension base="nsbase:BType">
                         <sequence>
                               <element name="a1" type="string" />
                        </sequence>
                  </extension>
            </complexContent>
      </complexType>
</schema>

Thanks


-----Original Message-----
From: Sergey Beryozkin [mailto:[email protected]]
Sent: Monday, October 15, 2012 11:22 AM
To: [email protected]
Cc: Mickael Marrache
Subject: Re: XML representation not translated to method parameter

Hi

Can you please send a complete WADL (only with these sample types, a single 
method saveA, etc) so that I can try ?

Thanks, Sergey

On 14/10/12 10:35, Mickael Marrache wrote:
Hi,

In the request of a PUT method in my WADL, I would like an application/xml 
representation to be sent.

The method declaration in the WADL:

<method id="saveA" name="PUT">
     <request>
        <representation mediaType="application/xml" element="ns1:A" />
     </request>
     <response status="200">
              ......
     </response>
</method>

The element and complexType declaration:

<element name="A" type="ns1:AType" />
<complexType name="AType">
     <complexContent>
        <extension base="tns1:BType">
           <sequence>
                          <element name="name" type="xsd:string" />
                </sequence>
        </extension>
     </complexContent>
</complexType>

But the generated method saveA doesn't take an instance of AType as parameter 
and I don't understand why.

I've found a similar question in the mailing list 
(http://mail-archives.apache.org/mod_mbox/cxf-users/201209.mbox/ajax/%3C506562CF.8020502%40gmail.com%3E).
 It seems that the argument tMap may be used to work around this issue.

Thanks



--
Sergey Beryozkin

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

Blog: http://sberyozkin.blogspot.com


--
Sergey Beryozkin

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

Blog: http://sberyozkin.blogspot.com

Reply via email to