I have my service defined as:
@Path("/fileservice")
public class FileService {
@POST
@Path("/path")
@Consumes("application/xml")
public Response getFilePath(FileRequest fileRequest) {
System.out.println("....." + fileRequest.client);
(...)
}
My activator:
@ApplicationPath("/services")
public class JaxRsActivator extends Application{
}
And the XML file mapping is defined as:
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name="fileDetails")
public class FileRequest {
@XmlElement public String path;
@XmlElement public String client;
And my client is:
public static void main(String args[]) throws Exception {
URI uri = new URI(SERVICE_URL);
Client client = ClientBuilder.newClient();
String xml = "<fileDetails> "
+ "<path>usr/test/a.pdf</path>"
+ "<client>abc</client>"
+"</fileDetails>" ;
Response response= client.target(uri).request().post(Entity.xml(xml));
System.out.println("Request posted :"+ response.getAllowedMethods());
System.out.println("Request posted, response status :"+ response.getStatus());
When I send request to the URL http://localhost:8080/xx/services/fileservice/path
I'm getting response.getStatus()
as 405.
What I'm doing wrong here?