Return-Path: Delivered-To: apmail-cxf-users-archive@www.apache.org Received: (qmail 5163 invoked from network); 16 Jun 2009 12:57:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 16 Jun 2009 12:57:46 -0000 Received: (qmail 88502 invoked by uid 500); 16 Jun 2009 12:57:57 -0000 Delivered-To: apmail-cxf-users-archive@cxf.apache.org Received: (qmail 88429 invoked by uid 500); 16 Jun 2009 12:57:56 -0000 Mailing-List: contact users-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@cxf.apache.org Delivered-To: mailing list users@cxf.apache.org Received: (qmail 88419 invoked by uid 99); 16 Jun 2009 12:57:56 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Jun 2009 12:57:56 +0000 X-ASF-Spam-Status: No, hits=3.7 required=10.0 tests=HTML_MESSAGE,SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of vincenzo.vitale@gmail.com designates 209.85.218.210 as permitted sender) Received: from [209.85.218.210] (HELO mail-bw0-f210.google.com) (209.85.218.210) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Jun 2009 12:57:47 +0000 Received: by bwz6 with SMTP id 6so4745463bwz.30 for ; Tue, 16 Jun 2009 05:57:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type; bh=drwOWGwJQgl7TUluBmGnQVVYgFydVeScx2DBktkpKIQ=; b=OA59n7bQQQeOqFYdQOqNAyHYq+2vDVMqe/R+NgshUu0omkBRcCh7BznsYr7x8f8snD nwIbYPj5TPGAEcX2rGgZWfUN2S6gLOor9nSQFUIYCVmBkI6KbE2230S+mujkE1mazkj4 jfoXh28K5pzvaQRbFFx8CpYuV5H+1bKXzsCm8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=mjvejx0cuU80tdxo8NQUeNqHCY05ShsslbTpv6109HtKN2qXC/gaDV+mLP+x1SLCje jpquyRzsCpL9HL+YKdeHneEWWUF/LYn1dzZlaGTx6YYY42wiLbQtgLFxmmpZNQMrG/q6 udBCaFXCQHHUVW8IdjapYEZtubpLlaG/wfG1I= MIME-Version: 1.0 Received: by 10.239.146.3 with SMTP id u3mr649220hba.52.1245157046170; Tue, 16 Jun 2009 05:57:26 -0700 (PDT) In-Reply-To: <019a01c9ee80$ab6afd70$1202050a@emea.progress.com> References: <00c901c9ee61$9f5de8e0$1202050a@emea.progress.com> <00f701c9ee66$7885a870$1202050a@emea.progress.com> <019a01c9ee80$ab6afd70$1202050a@emea.progress.com> From: Vincenzo Vitale Date: Tue, 16 Jun 2009 14:57:06 +0200 Message-ID: Subject: Re: Problem with JAXRSClientFactory after updating to 2.2.2 To: users@cxf.apache.org Content-Type: multipart/alternative; boundary=001485f9a84e6d361a046c76b74f X-Virus-Checked: Checked by ClamAV on apache.org --001485f9a84e6d361a046c76b74f Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit At the moment I can continue using 2.2; I will either upgrade when the fix is released or change the code with your suggestion (if I will really need a cxf update). If a Jira issue will be created, could you please send the link? Thanks, V. On Tue, Jun 16, 2009 at 2:47 PM, Sergey Beryozkin wrote: > I reproduced it. I didn't realize you were actually using a provider for > JAXRS Response. > Typically, if a JAXRS Response is returned then on the client side you just > write > > Response r = proxy.getSomeResponse(); > > and then directly handling the input stream inside the response. > But I understand now you actually registered a provider which would do it. > > Is there any chance you can try to deal with the actual type which is > embedded inside the Response ? > > Query q = tridionService.executeQuery(); > > and register a provider for tha type (Query in this example) ? > > if you need access to response headers, you can do > Response r = WebClient.client(tridionService).getResponse(); > > in meantime I'll fix this regression. I do have a test which returns a > Response but there no entity body is involved... > > thanks, Sergey > > > > > > ----- Original Message ----- From: "Vincenzo Vitale" < > vincenzo.vitale@gmail.com> > To: > Sent: Tuesday, June 16, 2009 12:09 PM > > Subject: Re: Problem with JAXRSClientFactory after updating to 2.2.2 > > > When switching to 2.2.2 I get a ResponseImpl object but the entity is >> null. >> Have you tried to add the line: >> >> assertNotNull(r.getEntity()); >> >> to your test? >> >> On Tue, Jun 16, 2009 at 11:40 AM, Sergey Beryozkin > >wrote: >> >> I;ve done a test and see no problems so far. here's the code. >>> >>> // Client test code >>> @Test >>> public void testTridionService() { >>> >>> List> providers >>> = >>> >>> new >>> ArrayList>(); >>> >>> providers.add(new ResponseReader()); >>> >>> >>> // We also need to pass the provider for deserializing the response >>> >>> // object. >>> >>> TridionQueryService tridionQueryServiceProxy = >>> >>> JAXRSClientFactory.create("http://localhost:9080", >>> >>> TridionQueryService.class, providers); >>> >>> >>> org.apache.cxf.systest.jaxrs.Response r = >>> tridionQueryServiceProxy.executeQuery("query", "id"); >>> >>> assertNotNull(r); >>> >>> >>> } >>> >>> // sample Response : >>> >>> >>> public class Response { >>> >>> >>> public int id; >>> >>> >>> } >>> >>> // Response Reader, used on the client side >>> >>> public class ResponseReader implements MessageBodyReader { >>> >>> >>> public boolean isReadable(Class type, Type genericType, Annotation[] >>> annotations, MediaType mediaType) { >>> >>> // TODO Auto-generated method stub >>> >>> return true; >>> >>> } >>> >>> >>> public Response readFrom(Class arg0, Type arg1, Annotation[] arg2, >>> MediaType arg3, MultivaluedMap arg4, >>> >>> InputStream arg5) throws IOException, WebApplicationException { >>> >>> // TODO Auto-generated method stub >>> >>> Response r = new Response(); >>> >>> XMLSource source = new XMLSource(arg5); >>> >>> String id = source.getValue("response/id"); >>> >>> r.id = Integer.parseInt(id); >>> >>> return r; >>> >>> } >>> >>> >>> } >>> >>> // ResponseWriter, used on the server side : >>> >>> public class ResponseWriter implements MessageBodyWriter { >>> >>> >>> public long getSize(Response t, Class type, Type genericType, >>> Annotation[] >>> annotations, MediaType mediaType) { >>> >>> // TODO Auto-generated method stub >>> >>> return 0; >>> >>> } >>> >>> >>> public boolean isWriteable(Class type, Type genericType, Annotation[] >>> annotations, MediaType mediaType) { >>> >>> // TODO Auto-generated method stub >>> >>> return true; >>> >>> } >>> >>> >>> public void writeTo(Response arg0, Class arg1, Type arg2, Annotation[] >>> arg3, MediaType arg4, >>> >>> MultivaluedMap arg5, OutputStream arg6) throws IOException, >>> WebApplicationException { >>> >>> StringBuilder sb = new StringBuilder(); >>> >>> sb.append("" + arg0.id + ""); >>> >>> arg6.write(sb.toString().getBytes()); >>> >>> arg6.flush(); >>> >>> } >>> >>> >>> } >>> >>> // TridionQueryServiceImpl : >>> >>> public class TridionQueryServiceImpl implements TridionQueryService { >>> >>> >>> public Response executeQuery(String query, String publication) throws >>> WebApplicationException { >>> >>> Response r = new Response(); >>> >>> r.id = 1; >>> >>> return r; >>> >>> } >>> >>> >>> } >>> >>> // Server start up : >>> >>> AXRSServerFactoryBean sf = new JAXRSServerFactoryBean(); >>> >>> sf.setResourceClasses(TridionQueryServiceImpl.class); >>> >>> >>> List providers = new ArrayList(); >>> >>> providers.add(new ResponseWriter()); >>> >>> sf.setProviders(providers); >>> >>> sf.setResourceProvider(TridionQueryServiceImpl.class, >>> >>> new SingletonResourceProvider(new TridionQueryServiceImpl())); >>> >>> sf.setAddress("http://localhost:9080/"); >>> >>> >>> sf.create(); >>> >>> >>> Vicio, can you please provbide more details : post sample response value, >>> sample Response and ResponseProvider, etc... >>> >>> thanks, Sergey >>> >>> >>> >>> >>> >>> >>> >>> >>> ----- Original Message ----- From: "Sergey Beryozkin" < >>> sberyozk@progress.com> >>> To: >>> Sent: Tuesday, June 16, 2009 10:05 AM >>> Subject: Re: Problem with JAXRSClientFactory after updating to 2.2.2 >>> >>> >>> >>> Hi >>> >>>> >>>> Sorry, your messages have been caught by the spam filter. >>>> Can you please use JAXRSClientFactoryBean directly please, may be >>>> there're >>>> some overloading issues among the factory utility methods.. >>>> Trying to do a quick test now... >>>> cheers, Sergey >>>> >>>> ----- Original Message ----- From: "Vincenzo Vitale" < >>>> vincenzo.vitale@gmail.com> >>>> To: >>>> Sent: Monday, June 15, 2009 11:59 AM >>>> Subject: Problem with JAXRSClientFactory after updating to 2.2.2 >>>> >>>> >>>> Hi, >>>> >>>>> after updating to CXF 2.2.2 the JAXRSClientFactory seems to not work >>>>> anymore having the entity field returned always to null. >>>>> >>>>> Here my code: >>>>> >>>>> >>>>> ArrayList> providers = >>>>> new ArrayList>(); >>>>> providers.add(new ResponseProvider()); >>>>> >>>>> // We also need to pass the provider for deserializing the >>>>> response >>>>> // object. >>>>> tridionQueryServiceProxy = >>>>> JAXRSClientFactory.create(getTridionProxyBaseAddress(), >>>>> TridionQueryService.class, providers); >>>>> >>>>> >>>>> >>>>> and than: >>>>> >>>>> tridionProxyResponse >>>>> = tridionQueryServiceProxy.executeQuery(query.toString(), >>>>> publicationId); >>>>> >>>>> >>>>> The common interface between server and client is: >>>>> >>>>> @Path("/query-service") >>>>> @Produces("application/xml") >>>>> public interface TridionQueryService { >>>>> >>>>> /** >>>>> * Execute a generic query in the Tridion system through a POST >>>>> request. >>>>> * >>>>> * @param query The query to be executed. >>>>> * @param publicationId The publication to use (in a normal Tridion >>>>> * implementation the publication id specify the channel to >>>>> use). >>>>> If >>>>> * the parameter is not passed a default value (different >>>>> depending >>>>> * on the implementation) will be used. >>>>> * @return A {@link Response} object containing the xml response >>>>> received >>>>> * from Tridion.. >>>>> */ >>>>> @POST >>>>> @Path("/execute") >>>>> Response executeQuery(@FormParam("query") String query, >>>>> @FormParam("channel") String publication) >>>>> throws WebApplicationException; >>>>> >>>>> >>>>> >>>>> Is someone experiencing the same problem. Is it a bug in CXF? >>>>> >>>>> >>>>> >>>>> Thanks, >>>>> Vicio. >>>>> >>>>> >>>>> >>>> >> --001485f9a84e6d361a046c76b74f--