cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: style sheet
Date Wed, 30 Nov 2011 10:07:25 GMT
Hi, please see comments inline

On 29/11/11 17:14, laksu wrote:
> Hi,
> I am new to JAXB, JAX-WS, JAX-RS and Apache CXF as well. Still I have been
> able to successfully publish a service of mine as web services and RESTful
> web service using CXF. Amazing.
super :-)

> My approach was having my Java service designed first and annotated my
> classes with JAXB and let the WSDL generated by CXF.
>
> @GET
> @Produces({MediaType.APPLICATION_XML,MediaType.TEXT_XML,MediaType.TEXT_HTML})
> @Path("listProducts")
> public List<Product>  listProducts() {...
>
> That works quite well and gets me the XML I wanted:
>
> <products>
>      <product id="1658" digitalId="5099972936955" title="Les lépidoptères"
> displayArtist="Jean-Louis Aubert">
>          <availabilities>
>               <availability territoryCode="GB" product="1658"
> streamingDate="2011-05-07T00:00:00+01:00"
> salesStartDate="2011-05-02T00:00:00+01:00">
>                    <id>15350</id>
>               </availability>
>               <availability territoryCode="AE" product="1658"
> streamingDate="2011-09-05T00:00:00+01:00"
> salesStartDate="2011-10-03T00:00:00+01:00">
>                    <id>15352</id>
>               </availability>
> ...
>          <availabilities>
>      <product id=...&lt;/product>
> ...
> </products>
>
>
> I am using Excel to get the data from this RESTful web service method and
> display to the user. (Excel-Data-Get external data from Web). That is
> because the user will be free to manipulate it further (filter, sort, chart,
> etc.)  However, Excel does some approximation on the data types and it does
> not work correctly with every field. For example dates are imported as text
> fields and if a field is comprised of digits then it is imported as a number
> field. I definitely need an XSD to accompany the generated XML files.
> I wonder if that schema can be generated automatically, either on the fly or
> during build?

How do you expect this schema be processed on the client side ? Would 
you like it included with the "products" payload itself or happy to see 
it referenced inside a WADL document ?
I'd recommend wrapping List<Product> in a Products bean - it is the only 
way at the moment for the JAX-RS runtime to auto-generate a schema.

Now, if the tool which is expecting these data back understands WSDL 
only then one option is to create such a WSDL upfront, generate a JAXWS 
code from it and then apply an external JAX-RS user model to it, but may 
be that won't be needed

Cheers, Sergey

> Thanks.
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/style-sheet-tp5033048p5033048.html
> Sent from the cxf-user mailing list archive at Nabble.com.


-- 
Sergey Beryozkin

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

Blog: http://sberyozkin.blogspot.com

Mime
View raw message