Hello,
El 07/06/13 11:51, Sergey Beryozkin escribió:
Hi
On 07/06/13 10:13, Gonzalo Aguilar Delgado wrote:
Hello,

I'm using CXF to create some services. I've found that complex input
parameters are not generated on description. So they cannot be handled
right by clients.

     @GET
     @Path("/list/detail/{query}/get")
     @WebMethod(operationName = "queryDetails")
     @WebResult(name = "response")
     public ServiceResponse<?> queryDetails(
             @Description("Query to be performed on server")
             @WebParam(name="query")
@PathParam("query") @QueryParam("query") MerchantQuery query);


-----

MerchantQuery is defined with setters and getters like this:


@XmlRootElement(name = "MerchantQuery")
@XmlType(name = "MerchantQuery", namespace =
"http://api.enterprise.level2crm.com";)
public class MerchantQuery implements IMerchantQuery {
     private static Logger log =
LoggerFactory.getLogger(MerchantQuery.class);

     private String contactPerson;
     private String contactEmail;
     private String fullName;
     private String otherName;
     private String neighborhoodCode;
     private String idCountry;
     private String url;
     private String contactPhone;
     private String postalCode;

     public MerchantQuery() {
     }
     ...


But WADL skip it! Everything on Response it's handled right. Why not
input values?


What should I do to force generator do what it does with response values?

Like this one:
<xs:complexType name="MerchantDetailData"><xs:sequence><xs:element
minOccurs="0" name="details" type="tns:MerchantDetailDTO"/><xs:element
minOccurs="0" name="identifiers"
type="tns:ResponseDataList"/><xs:element minOccurs="0" name="location"
type="tns:ResponseDataList"/></xs:sequence></xs:complexType>


The problem is you have the following:

      public ServiceResponse<?> queryDetails(
              @Description("Query to be performed on server")
              @WebParam(name="query")
@PathParam("query") @QueryParam("query") MerchantQuery query);

The first minor issue is that both @PathParam and @QueryParam are available, choose one of them.

Yes! you are right. I introduced the second one to check if that worked. But does not.


That said, the reason that no schema is generated is that @PathParam and @QueryParam will identify some portion of request URI, which can not be an XML fragment. If you had

public ServiceResponse<?> queryDetails(
              @Description("Query to be performed on server")
              @WebParam(name="query")
              MerchantQuery query);

Then the schema would be generated,

You are rigth! It generates. One thing that I didn't understand is that it makes sense to me to not be able to send an Object (JSON) as path parameter.

So what's the way to pass a JSON/XML object to this method via REST? Can I do it in the body of the request? But how do I tell the service that this param should go to the object query in the Service description?

Is this possible? Do I explain myself?

Thank you in advance.



Sergey


Thank you.




Reply via email to