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
>>
>>   
> 
> 

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

Reply via email to