Bonjour,
Je m'intéresse à REST... et je me suis inspiré de ce "Tutoriel REST" pour un 1er exemple
Le voici (1 getter et 1 setter en JAX-RS)...
@Path("rest")
public interface MyInterface
{
@GET
@Path("value")
public long getValue();
@PUT
@Path("value")
@Consumes("application/xml")
public void seValue(long value);
}
Question: pourquoi la 1ère requête est-elle OK mais pas la 2nde ??
GET http://localhost:8080/myInterface/rest/value
=> 200 OK
PUT http://localhost:8080/myInterface/rest/value HTTP/1.1
Content-Type: application/xml
User-Agent: Jakarta Commons-HttpClient/3.1
Host: localhost:8080
Content-Length: 25
<long>2000</long>
=> 400 BAD REQUEST
Ce "Body..." est probablement mal formaté?... mais comment l'écrire Svp ??
Merci,
Cordialement.
Partager