Return-Path: X-Original-To: apmail-cxf-issues-archive@www.apache.org Delivered-To: apmail-cxf-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D2794987F for ; Mon, 20 Feb 2012 18:34:03 +0000 (UTC) Received: (qmail 34213 invoked by uid 500); 20 Feb 2012 18:34:03 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 34179 invoked by uid 500); 20 Feb 2012 18:34:03 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 34168 invoked by uid 99); 20 Feb 2012 18:34:03 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Feb 2012 18:34:03 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Feb 2012 18:33:57 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 679A62AE505 for ; Mon, 20 Feb 2012 18:33:35 +0000 (UTC) Date: Mon, 20 Feb 2012 18:33:35 +0000 (UTC) From: "sonali majumdar (Commented) (JIRA)" To: issues@cxf.apache.org Message-ID: <1172296147.3142.1329762815425.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <428999948.2335.1327704970146.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (CXF-4075) The JAX-RS : Client API Unable to Handle Response Content Type "text/plain". Throws ClientWebApplicationException When Client Service Method is Invoked MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/CXF-4075?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13212020#comment-13212020 ] sonali majumdar commented on CXF-4075: -------------------------------------- I am facing a similar issue using Jackson1.9.3. Client API throws the error - Caused by: org.apache.cxf.jaxrs.client.ClientWebApplicationException: .No message body reader has been found for class : interface java.util.List, ContentType : text/html;charset=utf-8. at org.apache.cxf.jaxrs.client.AbstractClient.reportMessageHandlerProblem(AbstractClient.java:589) at org.apache.cxf.jaxrs.client.AbstractClient.readBody(AbstractClient.java:443) at org.apache.cxf.jaxrs.client.ClientProxyImpl.handleResponse(ClientProxyImpl.java:520) at org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(ClientProxyImpl.java:480) at org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:188) at $Proxy344.getBooksForSubscriber(Unknown Source) Here are the other relevant files - 1) Client Spring configuration file 2) Server Spring configuration file 3) Rest interface that is exposed @Path("/booksRegistry/") public interface BookMgmtService { @POST @Path("/getByCriteria") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) List getBooksForSubscriber(BookSubscriber subscriberId); } I am on Linux. It works perfectly on Windows .. But does that make any difference ? I tried using the custom jaxbProvider as you suggested but it does not work .. Do you know what the issue is ? Thanks, > The JAX-RS : Client API Unable to Handle Response Content Type "text/plain". Throws ClientWebApplicationException When Client Service Method is Invoked > ------------------------------------------------------------------------------------------------------------------------------------------------------- > > Key: CXF-4075 > URL: https://issues.apache.org/jira/browse/CXF-4075 > Project: CXF > Issue Type: Bug > Components: JAX-RS > Affects Versions: 2.5 > Environment: OS: Windows XP > JDK Version: 6 > Reporter: Nathan Gulley > Priority: Critical > Fix For: Invalid > > > The JAX-RS : Client API is unable to handle response content type "text/plain". The proxy client throws a ClientWebApplicationException > when the service call is made: > org.apache.cxf.jaxrs.client.ClientWebApplicationException: .No message body reader has been found for class : class com.sears.forgotpassword.ForgotPassword, ContentType : text/plain. > at org.apache.cxf.jaxrs.client.AbstractClient.reportMessageHandlerProblem(AbstractClient.java:593) > at org.apache.cxf.jaxrs.client.AbstractClient.readBody(AbstractClient.java:445) > at org.apache.cxf.jaxrs.client.ClientProxyImpl.handleResponse(ClientProxyImpl.java:527) > at org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(ClientProxyImpl.java:487) > at org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:188) > at $Proxy16.forgotPassword(Unknown Source) > at com.sears.mobilegateway.test.SHCAPIProfileServiceTest.testForgotPassword(SHCAPIProfileServiceTest.java:231) > WEB SERVICE URL: http://webservices.sears.com/shcapi/ForgotPassword?store=Sears&appID=MOB_IPH_SEARS_2GO&authID=xxxxxxxxxx&langId=-1&catalogId=12605&email=ngul23as196s9@yahoo.com > RESPONSE CONTENT TYPE: text/plain > RESPONSE CONTENT: > > > > 0 > > > > 10153 > -1 > 3uDXyoc2vtZi35gk3UVdyOC > > > Here are the detailed steps you need to follow in order to reproduce the bug: > 1. Define a REST client service class that points to a RESTful web service that returns content type "text/plain" > CLASS: import javax.ws.rs.GET; > import javax.ws.rs.POST; > import javax.ws.rs.Path; > import javax.ws.rs.QueryParam; > import com.sears.forgotpassword.ForgotPassword; > public interface SHCAPIProfileService { > @Path("/shcapi/ForgotPassword") @GET > public ForgotPassword forgotPassword(@QueryParam("email") String email, > @QueryParam("appID") String appID, > @QueryParam("authID") String authID, > @QueryParam("store") String store, > @QueryParam("catalogId") String catalogId, > @QueryParam("langId") String langId); > } > 2. Add the service class to your Spring configuration file as a CXF JAX-RS client bean. Configure the bean to accept content type > "text/plain": > > > > > > > 3. Use a Spring ApplicationContext to reference an instance of the client service bean in your code: > > ApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring-business-context.xml"); > SHCAPIProfileService shcapiProfileService = (SHCAPIProfileService)applicationContext.getBean("shcapiProfileService"); > 4. Call the "forgotPassword" service method on the service class: > ForgotPassword responseObj = shcapiProfileService.forgotPassword(LOGIN_ID, APP_ID, AUTH_ID, STORE, CATALOG_ID, LANG_ID); > > 5. The following ClientWebApplicationException is thrown when JAXB tries to unmarshall the response content into the "ForgotPassword" Java object: > org.apache.cxf.jaxrs.client.ClientWebApplicationException: .No message body reader has been found for class : class com.sears.forgotpassword.ForgotPassword, ContentType : text/plain. > at org.apache.cxf.jaxrs.client.AbstractClient.reportMessageHandlerProblem(AbstractClient.java:593) > at org.apache.cxf.jaxrs.client.AbstractClient.readBody(AbstractClient.java:445) > at org.apache.cxf.jaxrs.client.ClientProxyImpl.handleResponse(ClientProxyImpl.java:527) > at org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(ClientProxyImpl.java:487) > at org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:188) > at $Proxy16.forgotPassword(Unknown Source) > at com.sears.mobilegateway.test.SHCAPIProfileServiceTest.testForgotPassword(SHCAPIProfileServiceTest.java:231) > > NOTE: This exception should not occur since we configured the service class to accept content type "text/plain" in step 2. > I tried work arounds such as customizing the proxy by running the following code before making the client service call: > WebClient.client(shcapiProfileService).accept("text/plain"); > However these had no effect. The same error occurs. > -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira