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:36:45 UTC
Rest Webservices
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-tp5789252.html
Sent from the Camel - Users mailing list archive at Nabble.com.