Sergey, Here is the response I got on [email protected] from Marc Hadley:
I assume you are trying to describe a representation that contains a Boolean – right ? I think a better way to represent this would as follows: <representation mediaType=”text/plain”> <param name=”result” type=”xsd:Boolean” style=”plain”/> </representation> It might be worth considering switching from text/plain to something with a bit more structure. E.g. you could use application/x-www-form-urlencoded: instead of a body of “true” you’d send back “result=true”. That little bit of extra structure will allow you to add additional information in the future with less chance of breaking (well written) clients. In that case you’d use style=”query” in the param element. Personally I’d use JSON or XML but I understand the urge to keep things simple. Marc. On Thu, Sep 2, 2010 at 11:21 AM, Sergey Beryozkin <[email protected]>wrote: > Hi > > sorry for a delay > > On Fri, Aug 27, 2010 at 3:38 PM, gilgal <[email protected]> wrote: > > > > > When cxf generates my WADL I get references to objects in the grammar > > section, but if it is a primitive type it has a comment of what the > > primitive type is but no element attribute set. Is there a way to get > what > > is in the comment into the element attribute of the representation tag? > > > Here are two examples. > > References the object in the grammar: > > <resource path="/optout/individual/{individualId}"> > > > > <method name="GET"> > > <request/> > > <response> > > <representation mediaType="application/xml" element="prefix1:indOptOut"/> > > <representation mediaType="application/json"/> > > </response> > > </method> > > </resource> > > Has only a comment that it is xs:boolean: > > <resource path="/ministering/remove/{unitNbr}/{individualId}"> > > > > > > <method name="DELETE"> > > <request/> > > <response> > > <!-- Primitive type : xs:boolean --> > > <representation mediaType="application/xml"/> > > <!-- Primitive type : xs:boolean --> > > <representation mediaType="application/json"/> > > </response> > > </method> > > </resource> > > > > Thanks, > > Gil > > > > > This might be done in principle. I'm not sure though what it will mean. XML > schema does have datatypes such as xs:boolean, etc. But those datatypes are > meant to be used by schemas defining new custom (complex or simple) types > and elements, the XML ones. So if we have say a text/plain representation, > then saying that a it's of type xsd: > integer for example, using @element attribute, seems a bit strange. But > may > be it could be just to do with reusing existing well-known datatypes, so > > <representation mediaType="text/plain" element="xsd:boolean"/> > > is kind of ok... > I'll think about it. > In meantime, if you could ask for some clarifications on the WADL list then > it would really help. Ask if using @element="xsd:boolean" for non xml > representations is acceptable > > thanks, Sergey > > > > -- > > View this message in context: > > > http://cxf.547215.n5.nabble.com/WADL-generation-question-tp2740129p2740129.html > > Sent from the cxf-user mailing list archive at Nabble.com. > > >
