Thanks a lot. That worked ! On Wed, Aug 8, 2012 at 4:27 AM, Sergey Beryozkin-3 [via Camel] < ml-node+s465427n5716972...@n5.nabble.com> wrote:
> Hi > On 08/08/12 00:36, javakurious wrote: > > > Based on the example in http://camel.apache.org/cxfrs.html cxfrs > example > > with camel , I created a REST service exposed as GET operation. Here is > the > > overview of what I have so far : > > > > REST endpoint in Camel: > > <cxf:rsServer id="custmoer-rest-get-server" > > address="/" serviceClass="com.personal.test.impl.CustomerGETImpl"/> > > > > And the corresponding resource class used to configure the endpoint... > > > > CustomerGETImpl > > @GET > > @Path("/Customer") > > @Produces("text/xml") > > @Override > > public Response getCustomer(@QueryParam("CustomerName") String > > customerName) > > } > > > > It works fine. > > > > My question is if I have to expose the same service as POST as well, > what do > > I have to do ? > > > > I did the following : > > > > 1)Added additional REST endpoint in Camel: > > <cxf:rsServer id="custmoer-rest-get-server" > > address="/" serviceClass="com.personal.test.impl.CustomerGETImpl"/> > > <cxf:rsServer id="custmoer-rest-post-server" > > address="/" serviceClass="com.personal.test.impl.CustomerPOSTImpl"/> > > > > This is unlikely to work correctly given both servers are not related to > each other but have the same relative address > > > 2)Created a new corresponding resource class used to configure the > > endpoint... > > > > CustomerPOSTImpl > > @POST > > @Path("/Customer") > > @Produces("text/xml") > > @Override > > public Response getCustomer(@FormParam("CustomerName") String > > customerName) > > } > > > > If I deploy this configuration, the POST works but GET return status > 405. > > > > Can anybody shed some light on what I am doing wrong. > > > Try having a single service implementation with GET & POST handlers, > that should work > > Cheers, Sergey > > > Thanks > > > > > > > > > > > > -- > > View this message in context: > http://camel.465427.n5.nabble.com/exposing-same-REST-service-as-both-GET-and-POST-tp5716952.html > > Sent from the Camel - Users mailing list archive at Nabble.com. > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://camel.465427.n5.nabble.com/exposing-same-REST-service-as-both-GET-and-POST-tp5716952p5716972.html > To unsubscribe from exposing same REST service as both GET and POST, click > here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5716952&code=amF2YWt1cmlvdXNAZ21haWwuY29tfDU3MTY5NTJ8MjA2MzM2NjAxNw==> > . > NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- View this message in context: http://camel.465427.n5.nabble.com/exposing-same-REST-service-as-both-GET-and-POST-tp5716952p5717559.html Sent from the Camel - Users mailing list archive at Nabble.com.