Hi Gabo

Agreed about 1.
About 2 : the schema is generated by JAXB so WADLGenerator is not
controlling the prefixes on the schema itself. 'tns' is typically used by
convention. I can't use 'tns' on the top-level wadl:application though
because it won't work in cases when multiple schemas have been generated,
and it will be a bit confusing in cases when WADL instances are not using
default namespaces, because 'tns' would actually link to some other non-WADL
namespace. 
WADL processors should have no problems in processing 'prefix1'/prefix2',
etc, 'tns' won't be even visible to them....

cheers, Sergey


Gabo Manuel wrote:
> 
> Hi Sergey,
> 
> A few things:
> 
> 1. I have both XmlRootElement and XmlType annotations in my object. I 
> added namespace to both of them. By 2.2.4, I'll remove them both. 
> Currently still using the 2.2.3 release.
> 
> 2. The wadl generated has xmlns:tns and xmlns:prefix1 defined as 
> "http://domains.some";, with tns being used in the grammars, while 
> prefix1 is being used in the resources. Although, it would still 
> evaluate the same, I think it would be better to remove the duplicate 
> and just use the same namespace definition for both grammar and 
> resource, right?
> 
> Thanks
> 
> Gabo
> 
> Sergey Beryozkin wrote:
>> Hi Gabo
>>
>> I've just got it fixed. WADLgenerator will now introspect
>> package-info.java
>> in cases when @XmlRootElement has only a local name set and if the
>> namespace
>> is available then the resulting WADL will correctly link to a generated
>> schema element....
>>
>> thanks for raising this issue
>> Sergey
>>
>>
>> Sergey Beryozkin wrote:
>>   
>>> Hi Gabo
>>>
>>> MyObject has @XmlRootElement with only a local name specified. Does
>>> package-info.java has a namespace specified too, in addition to the
>>> local
>>> name ?
>>>
>>> cheers, Sergey
>>>
>>>
>>> Gabo Manuel wrote:
>>>     
>>>> Hi Sergey,
>>>>
>>>> I am a bit confused. How do I supply the namespace needed? I thought
>>>> the 
>>>> package-info.java would be enough.
>>>>
>>>> Yes, for now I would be limiting the consume to just text/xml. The 
>>>> initial intent was to take advantage of CXF's handling between xml and 
>>>> json. But for now, we would be sticking to text/xml.
>>>>
>>>> Gabo
>>>>
>>>> Sergey Beryozkin wrote:
>>>>       
>>>>> Hi Gabo
>>>>>
>>>>> thanks... 
>>>>> The reason you only see the '<representation/>' for my MyObject is
>>>>> that
>>>>> there's no namespace available , so even though the <grammars/>
>>>>> section
>>>>> has
>>>>> the schema embedded there's no way to link to it from the
>>>>> <representation/>.
>>>>> May be I should have some XML comment generated which will advise to
>>>>> check
>>>>> the schema (with no namespace) ? 
>>>>>
>>>>> You might also want to update Consumes("*/*") to require a more
>>>>> specific
>>>>> media type.
>>>>>
>>>>>   
>>>>>         
>>>>>> I haven't tried it lately without the providers, but are primitives
>>>>>> now
>>>>>> supported out of the box?
>>>>>>     
>>>>>>           
>>>>> They are but only for text/plain. I'll add a task to wrap them in some
>>>>> tag
>>>>> like <response> for xml media types
>>>>>
>>>>>   
>>>>>         
>>>>>> Also, is there somewhere to look to be able to use the tool that
>>>>>> creates
>>>>>> an http-centric client-code from the wadl?
>>>>>>     
>>>>>>           
>>>>> No, I haven't started working on the code gen tool yet....But it's on
>>>>> the
>>>>> map
>>>>>
>>>>> cheers, Sergey
>>>>>
>>>>>
>>>>>
>>>>> Gabo Manuel wrote:
>>>>>   
>>>>>         
>>>>>> Hi Sergey,
>>>>>>
>>>>>> Sorry for the late response. I may have misrepresented the method, it 
>>>>>> should be as follows:
>>>>>>
>>>>>> @WebService(name="MyObjectService")
>>>>>> @SOAPBinding(use=Use.LITERAL, style=Style.RPC)
>>>>>> @Consumes("*/*")
>>>>>> @Produces("text/xml")
>>>>>> @Path("/MyObjects")
>>>>>> public interface MyObjectService{
>>>>>>     @GET
>>>>>>     @Path("/")
>>>>>>     @WebMethod
>>>>>>     @WebResult(name="myObjectInstance")
>>>>>>     public MyObject getMyObject(
>>>>>>             @QueryParam("uniqueIDField")
>>>>>>             @WebParam(name="uniqueIDField")
>>>>>>             long uniqueIDField)
>>>>>>     ;
>>>>>>
>>>>>>     @PUT
>>>>>>     @Path("/")
>>>>>>     @WebMethod
>>>>>>     @WebResult(name="uniqueIDField")
>>>>>>     public long insertMyObject(
>>>>>>             @WebParam(name="myObjectInstance")
>>>>>>             MyObject myObjectInstance,
>>>>>>             @QueryParam("reason")
>>>>>>             @WebParam(name="reason")
>>>>>>             String reason
>>>>>>             )
>>>>>>     ;
>>>>>> }
>>>>>>
>>>>>> @WebService(endpointInterface="some.domain.MyObjectService", 
>>>>>> serviceName="MyObjectService", portName="MyObjectServicePort")
>>>>>> public class MyObjectServiceImpl implements MyObjectService{
>>>>>>     public MyObject getMyObject(long uniqueIDField) throws 
>>>>>> SolegyContingencyException{
>>>>>>         return new MyObject();
>>>>>>     }
>>>>>>     public long insertMyObject(MyObject myObjectInstance, String
>>>>>> reason) 
>>>>>> throws SolegyContingencyException{
>>>>>>         return 1;
>>>>>>     }
>>>>>> }
>>>>>>
>>>>>> @XmlType(name="MyObject")
>>>>>> @XmlAccessorType(XmlAccessType.PROPERTY)
>>>>>> @XmlRootElement(name="MyObject")
>>>>>> public class MyObject {
>>>>>>     private long uniqueIDField;
>>>>>>     @GET
>>>>>>     @Path("/uniqueIDField")
>>>>>>     public long getUniqueIDField() {
>>>>>>         return uniqueIDField;
>>>>>>     }
>>>>>>     public void setUniqueIDField(long uniqueIDField) {
>>>>>>         this.uniqueIDField = uniqueIDField;
>>>>>>     }
>>>>>> }
>>>>>>
>>>>>> The wadl section i get is something as follows:
>>>>>>
>>>>>> <method name="GET">
>>>>>>   <request>
>>>>>>     
>>>>>>   </request>
>>>>>>   <response>
>>>>>>     <representation mediaType="text/xml"/>
>>>>>>   </response>
>>>>>> </method>
>>>>>> <method name="PUT">
>>>>>>   <request>
>>>>>>     <representation/>
>>>>>>     
>>>>>>   </request>
>>>>>>   <response>
>>>>>>     <!-- Primitive type : xs:long --><representation
>>>>>> mediaType="text/xml"/>
>>>>>>   </response>
>>>>>> </method>
>>>>>>
>>>>>> And yes, I did specify text/xml. I also have providers included to
>>>>>> wrap 
>>>>>> the response in tags. I had to add the providers because at the time 
>>>>>> (2.0), primitives were not supported. I haven't tried it lately
>>>>>> without 
>>>>>> the providers, but are primitives now supported out of the box?
>>>>>>
>>>>>> Also, is there somewhere to look to be able to use the tool that
>>>>>> creates 
>>>>>> an http-centric client-code from the wadl?
>>>>>>
>>>>>> Thanks!
>>>>>>
>>>>>> Gabo.
>>>>>>
>>>>>> Sergey Beryozkin wrote:
>>>>>>     
>>>>>>           
>>>>>>> Hi Gabo
>>>>>>>
>>>>>>> It is an 'Object' so a WSDL generator has no idea what else to say,
>>>>>>> apart
>>>>>>> from <representation/>. If you add "Consumes' with some values then
>>>>>>> you'll
>>>>>>> get a bit more specific tag...
>>>>>>>
>>>>>>>
>>>>>>> However, there appears to be a bug :
>>>>>>>
>>>>>>> <response><!-- Primitive type : xs:long 
>>>>>>> --><representation
>>>>>>> mediaType="text/xml"/></response></method></resource>
>>>>>>>
>>>>>>> or do you have Produces('text/xml') on the class itself ? Can you
>>>>>>> please
>>>>>>> send me a class sample so that I can fix it ?
>>>>>>>
>>>>>>> cheers, Sergey
>>>>>>>   
>>>>>>>       
>>>>>>>             
>>>>>>     
>>>>>>           
>>>>>   
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>>
>>>>> No virus found in this incoming message.
>>>>> Checked by AVG - www.avg.com 
>>>>> Version: 8.5.409 / Virus Database: 270.13.62/2315 - Release Date:
>>>>> 08/20/09 06:05:00
>>>>>
>>>>>   
>>>>>         
>>>>       
>>>     
>>
>>   
>> ------------------------------------------------------------------------
>>
>>
>> No virus found in this incoming message.
>> Checked by AVG - www.avg.com 
>> Version: 8.5.409 / Virus Database: 270.13.65/2323 - Release Date:
>> 08/24/09 06:05:00
>>
>>   
> 
> 

-- 
View this message in context: 
http://www.nabble.com/JAX-RS-%3A-initial-WADL-support-tp24394736p25150491.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to