Hi,

The warning message is correct, because accordingly JAX-RS spec, the method 
must be selected based on URI, HTTP Verb, Request MediaType and Response 
Accepted Type:

" 3.7.2 Request Matching
A request is matched to the corresponding resource method or sub-resource 
method by comparing the normalized
request URI (see Section 3.7.1), the media type of any request entity, and the 
requested response
entity format to the metadata annotations on the resource classes and their 
methods. "

You have the following options:
1. Leave only single-object version with a POST. It makes easy to return URI of 
created resource in Location header or single error code in fault case.
If Option (1) is not acceptable because of performance reason, I would suggest 
either to
2. Introduce own media type (like application/point.collection+xml) and use 
POST to add all resources to the same URI. In this case you have to deal with 
multiple created URIs (return them to client directly or via result resource) 
and multiple error codes in fault case.
3. Introduce PUT to replace the whole collection. In this case client should be 
responsible to specify individual resource URIs. You have to deal with multiple 
error codes in fault case.

Regards,
Andrei.

> -----Original Message-----
> From: Vjacheslav V. Borisov [mailto:[email protected]]
> Sent: Donnerstag, 1. Oktober 2015 15:35
> To: [email protected]
> Subject: Re: Consuming mutiple xml representations on resource
> 
> 2015-10-01 14:16 GMT+04:00 Vjacheslav V. Borisov <[email protected]>:
> 
> > Hi!
> >
> > I am trying to model rest api  which can consume different xml
> > representations, but without success I have two methods on same url
> > which accepts application/xml, but different objects: single object
> > and collection of objects
> >
> >
> http://stackoverflow.com/questions/411462/restful-way-to-create-multiple-
> items-in-one-request
> 
> Another option is to use different method, like PUT (but PUT is like replacing
> collection), or PATCH  (modify collection) Unfortunately wadl2java do not
> generate @PATCH annotation for PATCH methods

Reply via email to