I'm sorry it takes so long to have the simple test working :-)
I will need to add a number of clarifications to the docs.

In the first case you need to use
"http://localhost:8081/SampleRestProject"; only and the proxy will get

"helloWorld" and "customers" from HelloWorld interface and
HelloWorld.getCustomers.

Is it the POST method which is used in this case ? As it happens, in 2.2.5,
proxies can not handle empty POSTS (those which do not have any bodies in
the request) due to a minor restriction in HttpConduit. Which would likely
explain the exception. But WebClients can do it ok. Do you need to have
empty POSTs? If yes then I can update you on how to do them with proxies
even with 2.2.5 (a custom out inter ceptor will be needed), otherwise update
a method signature such that a body is actually passed or swicth back to
WebClients. 

In the 2nd case you're still combining WebClients and proxies. You can, if
you need, move from proxies to webclients and vice versa but you can not
combine them the way you do, with WebClients one is not programming against
interfaces like HelloWorld, the only interface is GET/POST/etc...

Just do

WebClient clnt = WebClient
                               
.create("http://localhost:8081/SampleRestProject/helloWorld/customer";);
                clnt.accept("application/json");
                Customers customers = clnt.get(Customers.class);
              

cheers, Sergey 

Padmam wrote:
> 
> Hi Sergey,
> 
> I moved the annotations to Interface and changed the conf. to use jaxrs
> instead of http-binding.
> I tried to access the service with this code:
>               HelloWorld helloWorld =
> JAXRSClientFactory.create("http://localhost:8081/SampleRestProject/helloWorld/customers";,
> HelloWorld.class);
>               Customer customer = helloWorld.getCustomers();
>               System.out.println(customer.getName());
> 
> I get this exception: java.lang.IllegalStateException: Already connected 
> 
> When tried with WebClient:
> GET:
> WebClient clnt = WebClient
>                       
> .create("http://localhost:8081/SampleRestProject/helloWorld/customer";);
>               clnt.accept("application/json");
>               HelloWorld helloWorld = clnt.get(HelloWorld.class);
>               helloWorld.getCustomers();
> I get "org.apache.cxf.interceptor.Fault: Could not send Message."
> 
> POST Error:
> ".No message body reader found for class : interface
> com.tfs.pe.HelloWorld, ContentType : application/json."
> 
> Thanks
> Padmavathi V.
> 
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Re%3A-JAXRS---POST-tp26904409p27074045.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to