When I start camel in standalone mode I get a message that my routes are consuming from Endpoints that I have set up:
Route: route1 started and consuming from: Endpoint[http://localhost:9090/hrm/hrm_push?bindingStyle=SimpleConsumer]
Great!
But when I cut & past whats in between [] into my browser I'm getting a 404. Surely if Camel says it is consuming at that address I should be able to use that address to contact my Rest web service.
Here is my appContext
<bean id="transformer" class="com.xxxx.portlistener.services.Transformer">
</bean>
<cxf:rsServer id="pushServer"
address="http://localhost:9090/hrm/hrm_push?bindingStyle=SimpleConsumer" >
<cxf:serviceBeans>
<ref bean="transformer" />
</cxf:serviceBeans>
</cxf:rsServer>
<cxf:rsServer id="pingServer"
address="http://localhost:9090/hrm/hrm_ping" >
<cxf:serviceBeans>
<ref bean="transformer" />
</cxf:serviceBeans>
</cxf:rsServer>
<!-- Camel Configuration -->
<camel:camelContext id="camel-1" xmlns="http://camel.apache.org/schema/spring">
<package>com.xxxx.portlistener.services</package>
<camel:route id="route1">
<camel:from uri="cxfrs://bean://pushServer"/>
<camel:to uri="log:TEST?showAll=true" />
</camel:route>
<camel:route id="route2">
<camel:from uri="cxfrs://bean://pingServer"/>
<camel:to uri="log:TEST?showAll=true" />
</camel:route>
</camel:camelContext>
My Service Interface:
@Path("/hrm/")
public interface PushService
{
/**
* trasform will change the given Object....
*/
@POST
@Produces("text/plain")
@Path("/hrm_push/")
public Response pusher(Object pushee);
@GET
@Produces("text/plain")
@Path("/hrm_ping/")
public Response ping();
}
The error from the console:
Jan 21, 2014 10:45:50 AM org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor processRequest
WARNING: No root resource matching request path / has been found.
Jan 21, 2014 10:45:51 AM org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse
WARNING: WebApplicationException has been caught : no cause is available
Can anyone spot what I'm doing wrong?
Thanks,
Andrew
You have duplicated path settings in the CXF RS bean and in the Java annotations. The two will be combined, therefore the final URL will be something like http://localhost:9090/hrm/hrm_push
+ "/hrm/"
+ "/hrm_push/"
which is probably not what you wanted.
A recommendation would be to use the CXF RS bean to define the base URL only, then use the Java annotations for everything else.