Bonjour;
je veux réaliser un service web qui permet d'ajouter des offres ,je cherche un exemple qui peut m'aider ,j'ai essaye un exemple :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
@Path("ajouteroffre")
public class AjouteroffreResource {
     private TreeMap<Integer, Offre> offreMap = new TreeMap<Integer,Offre>();
    @Context
    private UriInfo context;
 
    /** Creates a new instance of AjouteroffreResource */
    public AjouteroffreResource() {
         Offre offre = new Offre();
           offre.setNum_offre(1);
           offre.setVille_depart("meknes");
            addOffre(offre);
    }
 
    /**
     * Retrieves representation of an instance of master.covoiturage.agent.AjouteroffreResource
     * @return an instance of java.lang.String
     */
 
 
    @GET
    @Produces("application/xml")
    public String getXml() {
        //TODO return proper representation object
        throw new UnsupportedOperationException();
    }
 
    /**
     * PUT method for updating or creating an instance of AjouteroffreResource
     * @param content representation for the resource
     * @return an HTTP response with content of the updated or created resource.
     */
   @POST
    @Consumes("application/xml")
   public String addOffre( Offre offre) {
        int id = offreMap.size();
    offre.setNum_offre(id);
    offreMap.put(id,offre);
    return "Offre " + offre.getVille_depart() + " added with Id " + id;
 
    //System.out.println("param1 = " + input.getId_utilisateur());
    //System.out.println("param2 = " + input.getNom_utilisateur());
 
 
    }
 
}
mais ça marche pas
veuillez m'aider s'il vous plait merci