cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gabo Manuel <kman...@solegysystems.com>
Subject Re: [CXF-2.2.5][JAVA-1.6] ReST on enums
Date Tue, 09 Mar 2010 11:51:02 GMT
Hi Sergey,

Got that. A few things though:

1. I added another enum on the same class like the following:

  @XmlType(name="MyEnum", namespace="http://some.domain.com")
  @XmlRootElement(name="MyEnum", namespace="http://some.domain.com")
  public static enum MyEnum {
      SOMEENUM1
      , SOMEENUM2
  }

  @XmlType(name="MyEnum2", namespace="http://some.domain.com")
  @XmlRootElement(name="MyEnum2", namespace="http://some.domain.com")
  public static enum MyEnum2 {
      SOMEENUM1
      , SOMEENUM2
  }


Only the first gets posted even if both are used in a method query as 
follows:

  @GET
  @Path("/search")
  @WebMethod
  @WebResult(name="someObject")
  public List<MyObject> getMyObjects(
          //@QueryParam("enumValue")
          @WebParam(name="enumValue")
          MyEnum enumValue,
          //@QueryParam("enumValue2")
          @WebParam(name="enumValue2")
          MyEnum2 enumValue2

  );

2. I'm currently using jakarta-commons' http-client for testing, and it is not allowing me
to add any body to the request. Not sure how to work around this one.

Thanks in advance.

Gabo

Sergey Beryozkin wrote:
> Hi Gabo
>
> You have a @QueryParam attached to it, is is only a method parameter
> representing a request body (the one having no JAXRS parameter annotations)
> that can be linked to a corresponding element in the grammar section...
>
> cheers, Sergey
>
> On Tue, Mar 9, 2010 at 5:09 AM, Gabo Manuel <kmanuel@solegysystems.com>wrote:
>
>   
>> Hi All,
>>
>> Just would like to inquire how to make certain set of enums show in the
>> wadl. Given the following:
>>
>> @WebService(name="MyService",
>>       targetNamespace="http://some.domain.com/")
>> @SOAPBinding(use=Use.LITERAL, style=Style.RPC)
>> @Consumes("*/xml")
>> @Produces("text/xml")
>> @Path("/MyService")
>> public interface MyService {
>>   @XmlType(name="MyEnum", namespace="http://some.domain.com")
>>   @XmlRootElement(name="MyEnum", namespace="http://some.domain.com")
>>   public static enum MyEnum {
>>       SOMEENUM1
>>       , SOMEENUM2
>>   }
>>     @GET
>>   @Path("/search")
>>   @WebMethod
>>   @WebResult(name="someObject")
>>   public List<MyObject> getMyObjects(
>>           @QueryParam("enumValue")
>>           @WebParam(name="enumValue")
>>           MyEnum enumValue
>>   );
>> }
>>
>>
>> @XmlType(name="MyObject", namespace="http://some.domain.com")
>> @XmlAccessorType(XmlAccessType.PROPERTY)
>> @XmlRootElement(name="MyObject", namespace="http://some.domain.com")
>> public class WSMyObject{
>>   private Map<String, String> internalCopy = new HashMap<String, String>();
>>      public WSMyObject(){}
>>   public WSMyObject(Map<String, String> internalCopy){
>>       if(internalCopy == null){
>>           internalCopy = new HashMap<String, String>();
>>       }
>>       this.internalCopy = internalCopy;
>>   }
>>      public Map<String, String> getMap() {
>>       return internalCopy;
>>   }
>>      public void setMap(Map<String, String> internalCopy) {
>>       if(internalCopy == null){
>>           internalCopy = new HashMap<String, String>();
>>       }
>>       this.internalCopy = internalCopy;
>>   }
>> }
>>
>>
>> Issues are:
>>
>> 1. The enums are listed properly for the soap service, which is good.
>> However, the enums are not listed for the wadl.
>>
>> 2. The result is displayed properly for soap service as a complex type,
>> again as wanted. However, it is not displayed in the grammar section of
>> wadl.
>>
>> Maybe I'm missing some annotation for both, but the enums example in the
>> users guide (Gender) does not have any annotation at all. The method
>> functions fine and as expected. It just requires an extra explanation in the
>> doc as to what values are to be expected, something I hope to avoid since it
>> would be possible to specify it in the wadl/wsdl.
>>
>> Thanks in advance.
>>
>> Gabo
>>
>>     
>
>   

Mime
View raw message