cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sergey.beryoz...@iona.com>
Subject Re: Running into problems with using WebClient
Date Wed, 29 Jul 2009 21:00:06 GMT

Hi

It's an issue with CXF JAXRS 2.2.2, the logging interceptor replaces the
HTTP in stream with another InputStream but WebClient fails to check it and
reads the HTTP stream again. Fixed in 2.2.3, for now please remove a logging
interceptor once you've confirmed the message is coming back
thanks, Sergey

 

kiran.sidhu wrote:
> 
> Hi,
> 
>                  I have a simple RESTful Web Service that I got from one
> of the samples on the web.  I am able to invoke it from browser and it
> shows the output on the browser, but when I try and call it from my
> client code using WebClient, it's throwing the following exception, Am I
> missing something ?
> 
>  
> 
> WARNING: .No operation matching request path /customers is found,
> ContentType : */*, Accept :
> text/html,application/xhtml+xml,application/xml,.
> 
> Jul 29, 2009 10:38:23 AM
> org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse
> 
> WARNING: WebApplicationException has been caught : no cause is available
> 
> Jul 29, 2009 10:38:23 AM
> org.apache.cxf.interceptor.LoggingOutInterceptor$LoggingCallback onClose
> 
>  
> 
> Here is the Client code :
> 
>  
> 
> WebClient wc =
> WebClient.create("http://localhost:8080/cxf-webservices/webservices/cust
> omerservice");
> 
> wc.accept("text/html,application/xhtml+xml,application/xml");     
> 
> Response getresponse = wc.path("/customers").get();
> 
>  
> 
>  
> 
> Here is the Web Service :
> 
>     <jaxrs:server id="customerService" address="/">   
> 
>       <jaxrs:serviceBeans>  
> 
>           <ref bean="customerservice"/>
> 
>         </jaxrs:serviceBeans>
> 
>       </jaxrs:server>  
> 
>       <bean id="customerservice" class="test.CustomerService" />
> 
>  
> 
>  
> 
> @Path("/customerservice/")   
> 
> @Produces("text/xml")
> 
> public class CustomerService {
> 
>  
> 
>       private TreeMap<Integer, Customer> customerMap = new
> TreeMap<Integer, Customer>();
> 
>       public CustomerService() {
> 
>             //Hard coded for testing
> 
>             Customer customer = new Customer();
> 
>             customer.setId(0);
> 
>           customer.setName("Harold Abernathy");
> 
>           customer.setAddress("Sheffield, UK");
> 
>           addCustomer(customer);
> 
>     } 
> 
>  
> 
>         @GET
> 
>         @Path("/customers")
> 
>         public CustomerCollection getCustomers() {
> 
>           return new CustomerCollection( customerMap.values());
> 
>         }
> 
>  
> 
>         @GET
> 
>         @Path("/customers/{id}")
> 
>         public Customer getCustomer(@PathParam("id") int cId) {
> 
>               
> 
>           return customerMap.get(cId);
> 
>         }
> 
>  
> 
>         @POST
> 
>         @Path("/customers/add")
> 
>         @Produces("text/plain")
> 
>         @Consumes("application/xml")
> 
>         public String addCustomer(Customer customer) {
> 
>           int id = customerMap.size();
> 
>           customer.setId(id);
> 
>           customerMap.put(id, customer);
> 
>           return "Customer " + customer.getName() + " added with Id " +
> id;
> 
>         }
> 
>  
> 
> Any help will be appreciated.
> 
> Thanks
> 
> Kiran
> 
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _
> 
> Notice: This information is intended only for the person(s) or entity(ies)
> to which it is addressed. This information may contain information that is
> confidential or otherwise protected from disclosure. If you are not the
> intended recipient of this message, or if this message has been addressed
> to you in error, please immediately alert the sender by reply e-mail and
> then delete this message, including any attachments. Any dissemination,
> distribution or other use of the contents of this message by anyone other
> than the intended recipient is strictly prohibited.
> 
> 

-- 
View this message in context: http://www.nabble.com/Running-into-problems-with-using-WebClient-tp24724574p24727454.html
Sent from the cxf-user mailing list archive at Nabble.com.


Mime
View raw message