I have written a Restful web service API, which is accepting two different Object, Is it possible to call this api using Jersey client. I am not able to call this using Jersey client. Is this a limitation of Rest API that we can not pass multiple objects to a method.
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@Path("/hello")
public class TimePassService {
@POST
@Path("/post")
@Consumes(MediaType.APPLICATION_JSON)
public Response saveEmployeeInfo(final Employee input,final Manager input1) {
String result = "Employee saved : " + input;
System.out.println(input);
System.out.println(input1);
return Response.status(201).entity(result).build();
}
}
When I discussed this with some techies, they replied that it is not possible, The solution is to wrap these two object into a third object and then pass a single Object.
Please let me know if there is some other solution of this.