[
https://issues.apache.org/jira/browse/CXF-3760?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Marco Schulte updated CXF-3760:
-------------------------------
Description:
Given the sample interface invoiceWebservice:
{{
@Path("invoice/")
@Consumes(MediaType.APPLICATION_XML)
@Produces(MediaType.APPLICATION_XML)
public interface InvoiceWebservice {
@POST
public void insert(WSInvoice wsInvoice);
[...]
}
}}
The usage of insert of this sample interface will cause an error, if used as
both client and server interface.
The client will send the http header "Accept: text/plain" due to return type
void of insert(WSInvoice). But the server will respond with http "406 not
acceptable", because the method inherited @Produces(MediaType.APPLICATION_XML).
A workaround is to only annotate the methods, so insert does not get an
@Produces annotation, or adding "text/plain" to @Consumes.
was:
Given the sample interface invoiceWebservice:
@Path("invoice/")
@Consumes(MediaType.APPLICATION_XML)
@Produces(MediaType.APPLICATION_XML)
public interface InvoiceWebservice {
@POST
public void insert(WSInvoice wsInvoice);
[...]
}
The usage of insert of this sample interface will cause an error, if used as
both client and server interface.
The client will send the http header "Accept: text/plain" due to return type
void of insert(WSInvoice). But the server will respond with http "406 not
acceptable", because the method inherited @Produces(MediaType.APPLICATION_XML).
A workaround is to only annotate the methods, so insert does not get an
@Produces annotation, or adding "text/plain" to @Consumes.
> Problematic inheritance of @Produces/@Consumes
> ----------------------------------------------
>
> Key: CXF-3760
> URL: https://issues.apache.org/jira/browse/CXF-3760
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS
> Affects Versions: 2.4.2
> Reporter: Marco Schulte
>
> Given the sample interface invoiceWebservice:
> {{
> @Path("invoice/")
> @Consumes(MediaType.APPLICATION_XML)
> @Produces(MediaType.APPLICATION_XML)
> public interface InvoiceWebservice {
> @POST
> public void insert(WSInvoice wsInvoice);
> [...]
> }
> }}
> The usage of insert of this sample interface will cause an error, if used as
> both client and server interface.
> The client will send the http header "Accept: text/plain" due to return type
> void of insert(WSInvoice). But the server will respond with http "406 not
> acceptable", because the method inherited
> @Produces(MediaType.APPLICATION_XML).
> A workaround is to only annotate the methods, so insert does not get an
> @Produces annotation, or adding "text/plain" to @Consumes.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira