Bonjour,
Je cherche des explications détaillées sur comment tester un web service REST avec SOAPui.
J'aimerais savoir également s'il existe un outil mieux que SOAPui, pour tester les WS REST ?
Merci d'avance pour votre aide.
Version imprimable
Bonjour,
Je cherche des explications détaillées sur comment tester un web service REST avec SOAPui.
J'aimerais savoir également s'il existe un outil mieux que SOAPui, pour tester les WS REST ?
Merci d'avance pour votre aide.
Bonjour,
J'ai trouvé un outil assez intéressant pour faire des tests : le pluging de google chrome Postman .
J'ai réussi à tester des requêtes GET , mais je n'arrive pas à faire une requête POST .
Voici le code de la méthode POST pour ajouter un Service :
voici une capture de mon essai de la méthode POST :Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 @POST @Consumes("application/xml") public Response createService(Service s) { EntityManagerFactory emf = Persistence .createEntityManagerFactory(Member.PERSISTENCE_UNIT); EntityManager em = emf.createEntityManager(); EntityTransaction tx = em.getTransaction(); tx.begin(); Member m = em.find(Member.class, this.memberId); s.setId(0); s.setMember(m); em.persist(s); tx.commit(); em.close(); emf.close(); return Response.created(URI.create("/" + s.getId())).build(); }
http://img15.hostingpics.net/pics/494483Capture1.png
et voici l'erreur affiché par Postman :
Merci d'avance pour votre aide .Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 <html> <head> <title>VMware vFabric tc Runtime 2.7.0.RELEASE/7.0.27.A.RELEASE - Error report</title> <style> <!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--> </style> </head> <body> <h1>HTTP Status 415 - </h1> <HR size="1" noshade="noshade"> <p> <b>type</b> Status report </p> <p> <b>message</b> <u></u> </p> <p> <b>description</b> <u>The server refused this request because the request entity is in a format not supported by the requested resource for the requested method ().</u> </p> <HR size="1" noshade="noshade"> <h3>VMware vFabric tc Runtime 2.7.0.RELEASE/7.0.27.A.RELEASE</h3> </body> </html>
Bonjour,
a mon avis les web services restFull n'utilise pas SOAP comme protocole d'échange d'information juste envoi des données en format JSON ou XML comme vous lancez une requéte ajax ..
ok . stp , peux tu m'expliquer un peu comment tester les requêtes POST et PUT .
Merci .