I am trying a JAX-RS web service with a complex object as input parameter
which comprises bunch of parameters to process the service.  The request
parameters could vary depending upon the criteria and hence used @QueryParam
to map parameters and expect JAX-RS to populate my JAXB input object. But
somehow the mapping is not working.  Appreciate your help.

Input Object:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SearchRequestType", propOrder = {
    "departmentName"
})
public class SearchRequestType {

    @XmlElement(required = true)
    protected String departmentName;

//with getters and setters...

}

Service Interface:

@Path("/empService")
public interface IEmployeeService {

   @GET
   @Path("/getEmployees")
   public GetEmployeeResponseType getEmployees(
        @QueryParam("departmentName") SearchRequestType request)
        throws WebServiceException;

}

        <jaxrs:server id="empService" address="/rest">
                <jaxrs:serviceBeans>
                        <ref bean="empService" />
                </jaxrs:serviceBeans>
        </jaxrs:server>

http://localhost:8080/mycxf/rest/empService/getEmployees?departmentName=accounts

Error Log:

SEVERE: Parameter Class com.test.mycxf.empservice.types.SearchRequestType
has no constructor with single String parameter, static valueOf(String) or
fromString(String) methods
Feb 10, 2011 5:59:43 AM
org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse
WARNING: WebApplicationException has been caught : no cause is available
-- 
View this message in context: 
http://cxf.547215.n5.nabble.com/Mapping-Complex-input-object-in-JAX-RS-service-tp3379441p3379441.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to