Hi,

Any help on creating client for accessing POST method?

Thanks
Padma.


Padmam wrote:
> 
> Hi,
> 
> I tried to create a RestFul JSON service with CXF. The example works for
> GET method. When i try the same with POST method, i get ".No operation
> matching request path found" error message. 
> URL I hit is:
> http://localhost:8081/SampleRestProject/helloWorld/customers.
> Find below resource class and bean definition.
> 
> @Path("/")
> @Produces("application/json")
> public class HelloWorldImpl implements HelloWorld
> {
> 
>       @POST
>       @Produces("application/json")
>       @Consumes("application/json")
>       @Path("/customers")
>       public Customer getCustomers() {
>               Customer customer = new Customer();
>               customer.setId(1);
>               customer.setName("Padma");
>               return customer;
>       }
> 
> }
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans";
>       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>       xmlns:jaxrs="http://cxf.apache.org/jaxrs";
>       xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
> http://cxf.apache.org/jaxrs
> http://cxf.apache.org/schemas/jaxrs.xsd
> ">
> 
>       <!-- do not use import statements if CXFServlet init parameters link to
> this beans.xml -->
> 
>       <import resource="classpath:META-INF/cxf/cxf.xml" />
>       <import
>               
> resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
>       <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
> 
>       <jaxrs:server id="helloWorldService" address="/helloWorld">
>               <jaxrs:serviceBeans>
>                       <ref bean="helloWorld" />
>               </jaxrs:serviceBeans>
>                <jaxrs:extensionMappings>
>                       <entry key="json" value="application/json" />
>                       <entry key="xml" value="application/xml" />
>               </jaxrs:extensionMappings>  
>               
>       </jaxrs:server>
> 
>       <bean id="helloWorld" class="com.tfs.pe.HelloWorldImpl" />
> 
> 
>       </beans>
> 
> Please help.
> 
> Thanks
> Padma
> 
> 

-- 
View this message in context: 
http://old.nabble.com/JAXRS---POST-tp26897610p26977475.html
Sent from the cxf-dev mailing list archive at Nabble.com.

Reply via email to