You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Gunjara <mg...@gmail.com> on 2016/10/26 03:09:49 UTC

Rest Webservices problem

Hi I'm very new to camel . I'm working on rest webservices , But I'm failing
to invoke remote endpoint. Please help me on this.    
  

 In Resource
========================
    @GET
    @Path("/wnnc/{wnncId}")
    ArrayList<Price> getPriceList(@QueryParam("storeId") String storeId ,
@QueryParam("offer") String offer);




   IN Router
=============

@Override
	public void configure() throws Exception {       
		
from("cxfrs:http://localhost:8989?resourceClasses=org.myapp.myapi.resource.PriceResource&bindingStyle=SimpleConsumer").removeHeaders("CamelHttp*").setExchangePattern(ExchangePattern.InOut)
          .setHeader(Exchange.HTTP_METHOD, constant("GET"))
		  
	    
		   
.to("http://mycompany.org/v3/price/wnnc/{header.wnncId}?store={header.storeId}&offer={header.offer}").to("file:output")

		    
          // call the route based on the operation invoked on the REST web
service
          .toD("direct:${header.operationName}");
		 
		
		
		  from("direct:getPriceList")
          .bean("priceService",
"getPriceList(${header.wnncId},{header.storeId},{header.offer})");


	 SimpleRegistry registry = new SimpleRegistry(); 
		  registry.put("priceService", new PriceServiceImpl()); 
		  CamelContext context = new DefaultCamelContext(registry); 
	        try {
	            context.addRoutes(new PriceRoute());
	            ProducerTemplate template = context.createProducerTemplate();
	            context.start();
	            Thread.sleep(20000);
	            template.sendBody("direct:restClient", "Test Input");

	        } finally {
	            context.stop();
	        }
  
		  
}

===============================

now I want to call from Postman and get the JSON file . But I'm not hitting
the remote endpoint. I'm very new to camel can you please help me on this.

http://localhost:8989/wnncID/12345?storeId=1234&header="true"


Regards,
Gunjara.




--
View this message in context: http://camel.465427.n5.nabble.com/Rest-Webservices-problem-tp5789250.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Rest Webservices problem

Posted by souciance <so...@gmail.com>.
Maybe I am seeing wrong but your from(uri) and the uri you are posting
don't look the same.  You have a /wncid which does not seem to exist in the
from(uri).

On Wed, Oct 26, 2016 at 5:09 AM, Gunjara [via Camel] <
ml-node+s465427n5789250h13@n5.nabble.com> wrote:

> Hi I'm very new to camel . I'm working on rest webservices , But I'm
> failing to invoke remote endpoint. Please help me on this.
>
>
>  In Resource
> ========================
>     @GET
>     @Path("/wnnc/{wnncId}")
>     ArrayList<Price> getPriceList(@QueryParam("storeId") String storeId ,
> @QueryParam("offer") String offer);
>
>
>
>
>    IN Router
> =============
>
> @Override
>         public void configure() throws Exception {
>                  from("cxfrs:http://localhost:8989?resourceClasses=org.
> myapp.myapi.resource.PriceResource&bindingStyle=SimpleConsumer").
> removeHeaders("CamelHttp*").setExchangePattern(ExchangePattern.InOut)
>           .setHeader(Exchange.HTTP_METHOD, constant("GET"))
>
>
>                     .to("http://mycompany.org/v3/price/wnnc/
> {header.wnncId}?store={header.storeId}&offer={header.offer}").to("file:output")
>
>
>
>           // call the route based on the operation invoked on the REST web
> service
>           .toD("direct:${header.operationName}");
>
>
>
>                   from("direct:getPriceList")
>           .bean("priceService", "getPriceList(${header.wnncId}
> ,{header.storeId},{header.offer})");
>
>
>          SimpleRegistry registry = new SimpleRegistry();
>                   registry.put("priceService", new PriceServiceImpl());
>                   CamelContext context = new
> DefaultCamelContext(registry);
>                 try {
>                     context.addRoutes(new PriceRoute());
>                     ProducerTemplate template = context.createProducerTemplate();
>
>                     context.start();
>                     Thread.sleep(20000);
>                     template.sendBody("direct:restClient", "Test Input");
>
>                 } finally {
>                     context.stop();
>                 }
>
>
> }
>
> ===============================
>
> now I want to call from Postman and get the JSON file . But I'm not
> hitting the remote endpoint. I'm very new to camel can you please help me
> on this.
>
> http://localhost:8989/wnncID/12345?storeId=1234&header="true"
>
>
> Regards,
> Gunjara.
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/Rest-Webservices-problem-tp5789250.html
> To start a new topic under Camel - Users, email
> ml-node+s465427n465428h31@n5.nabble.com
> To unsubscribe from Camel - Users, click here
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=c291Y2lhbmNlLmVxZGFtLnJhc2h0aUBnbWFpbC5jb218NDY1NDI4fDE1MzI5MTE2NTY=>
> .
> 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/Rest-Webservices-problem-tp5789250p5789259.html
Sent from the Camel - Users mailing list archive at Nabble.com.