Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Upgraded to 3.0.0, now Rest service receiving xml give 400 Bad request

$
0
0
Hi.

I upgraded to cxf 3.0.0 and now my REST service works fine with json but
returns 400 bad request with xml. Same test with xml and json on my
previous system with cxf 2.7.6 passes.

What could I be missing? Are there more/different .jars that need to be
included? Does an xml provider need to be specified? Something else?

Thanks.

Response:
HTTP/1.1 400 Bad Request
Content-Length: 0
Date: Sat, 26 Jul 2014 04:37:21 GMT
Server: Jetty(8.1.15.v20140411)

pom.xml:
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>${apacheCxfVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${apacheCxfVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>${apacheCxfVersion}</version>
</dependency>

<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-core</artifactId>
<version>${apacheCxfVersion}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-client</artifactId>
<version>${apacheCxfVersion}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>

applicationContext.xml:

<jaxrs:server id="ecpWebServices"
basePackages="com.twc.ctg.ecp.service.rest.custom"
address="http://0.0.0.0:8877" depends-on="activeMQConnectionFactory">
<jaxrs:inInterceptors>
<ref bean="validationInInterceptor"/>
</jaxrs:inInterceptors>
<jaxrs:outInterceptors>
<ref bean="validationOutInterceptor"/>
</jaxrs:outInterceptors>
<jaxrs:serviceBeans>
<ref bean="ecpAdminRestServiceV1"/>
<ref bean="ecpApplicationRestServiceV1"/>
<ref bean="ecpEntitlementRestServiceV1"/>
<ref bean="ecpEntitlementRestServiceV2"/>
<ref bean="ecpMetricsRestServiceV1"/>
<ref bean="ecpAlertsRestServiceV1"/>
<ref bean="ecpCDRestServiceV1"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean
class="com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider"/>
<ref bean="genericRestExceptionMapper"/>
</jaxrs:providers>

REST service:
@POST
@Path("/entitlement")
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@HeaderValidation
@Valid
public Response postEntitlement(@Context final HttpServletRequest
request, @NotNull @Valid final Entitlement Entitlement) throws
GenericRestException

. . .

Viewing all articles
Browse latest Browse all 5648

Trending Articles