Hi, I am using a Camel CFXRS server, configured with the SimpleConsumer binding style, to expose REST services from my web application. Although I have seen no issues with Camel injecting into the exchange message header the path parameters that are defined on the REST interface, the query parameters are not being injected. Instead, the in-body of the exchange message is being set to the value of the first query parameter.
I found mention of this issue on the nabble message board (http://camel.465427.n5.nabble.com/JAX-RS-and-Camel-Except-1st-QueryParameter-all-others-are-null-tt5742470.html), but the post dates back to October 2013 and it's unclear what version of Camel and Camel-CXF the poster was using at the time. I have tested my application code with both Camel v2.16.1 and v2.17.0, and the issue appears to be present in both distributions. Is this a known issue that I will need to work around? Of course, it's always possible that I do not have something setup quite right, so I've included both my REST service dispatching route, the interface providing the REST API, as well as the exchange message logged for an invocation of each method on the API. Thanks, Tony Here is the REST dispatching route: from("cxfrs:bean:rsServer?bindingStyle=SimpleConsumer") .recipientList(simple("direct:${header.operationName}")); Here are the methods that I have declared on my REST interface: /** * Declares multiple path parameters */ @GET @Path("/{masterpartyId}/address/{addressId}") @Produces("application/json") public Response getMasterPartyAddress(@PathParam("{masterPartyId}") String masterPartyId, @PathParam("{addressId}") String addressId); /** * Declares a single query parameter */ @GET @Produces("application/json") public Response findMasterParty(@QueryParam("firstName") String firstName); Test #1 - URI: http://localhost:9080/MasterPartyServiceWeb/rest/masterparty/100511414/address/12345 Test #1 Exchange message - note - the masterPartyId and the addressId are injected into the header as expected: 2016-04-06 08:37:39,076 [utor-thread-635] INFO TEST - Exchange[Id: ID-VDDK03P-6BB2764-57224-1459942270612-0-42, ExchangePattern: InOut, Properties: {CamelCorrelationId=ID-VDDK03P-6BB2764-57224-1459942270612-0-40, CamelCreatedTimestamp=Wed Apr 06 08:37:39 EDT 2016, CamelMessageHistory=[DefaultMessageHistory[routeId=route4, node=recipientList1], DefaultMessageHistory[routeId=route5, node=to3]], CamelMulticastComplete=true, CamelMulticastIndex=0, CamelRecipientListEndpoint=direct://getMasterPartyAddress_rest, CamelToEndpoint=log://TEST?showAll=true}, Headers: {Accept=*/*, accept-encoding=gzip, deflate, sdch, Accept-Language=en-US,en;q=0.8, addressId=12345, Authorization=Basic bjAyODE0NTk6cTRtRTVBUWs=, breadcrumbId=ID-VDDK03P-6BB2764-57224-1459942270612-0-39, Cache-Control=no-cache, CamelAcceptContentType=*/*, CamelCxfMessage={org.apache.cxf.message.MessageFIXED_PARAMETER_ORDER=false, org.apache.cxf.resource.method=public javax.ws.rs.core.Response com.lmig.pi.masterpartyservice.rest.impl.MasterPartyResourceImpl.getMasterPartyAddress(java.lang.String,java.lang.String), http.base.path=http://localhost:9080/MasterPartyServiceWeb, HTTP.REQUEST=com.ibm.ws.webcontainer31.srt.SRTServletRequest31@ea80ce26, org.apache.cxf.transport.Destination=org.apache.cxf.transport.servlet.ServletDestination@8953463e, HTTP.CONFIG=Servlet->null getClassName->org.apache.cxf.transport.servlet.CXFServlet getName->CXFServlet mapping->/* loadOnStartupWeight->1 getInitParameters->null or empty init parametersisAsyncSupported->false getDescription->null , jaxrs.template.parameters={FINAL_MATCH_GROUP=[/], masterpartyId=[100511414], addressId=[12345]}, org.apache.cxf.message.Message.QUERY_STRING=null, org.apache.cxf.jaxrs.model.OperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@c5e906a6], HTTP.CONTEXT=com.ibm.ws.webcontainer31.facade.ServletContextFacade31@ea9af9c4, Content-Type=null, org.apache.cxf.security.SecurityContext=org.apache.cxf.transport.http.AbstractHTTPDestination$2@6f2886dd, org.apache.cxf.message.Message.PROTOCOL_HEADERS={Accept=[*/*], accept-encoding=[gzip, deflate, sdch], Accept-Language=[en-US,en;q=0.8], Authorization=[Basic bjAyODE0NTk6cTRtRTVBUWs=], Cache-Control=[no-cache], connection=[keep-alive], Content-Type=[null], Host=[localhost:9080], User-Agent=[Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36]}, org.apache.cxf.request.url=http://localhost:9080/MasterPartyServiceWeb/rest/masterparty/100511414/address/12345, Accept=*/*, org.apache.cxf.request.uri=/MasterPartyServiceWeb/rest/masterparty/100511414/address/12345, org.apache.cxf.message.Message.PATH_INFO=/MasterPartyServiceWeb/rest/masterparty/100511414/address/12345, org.apache.cxf.transport.https.CertConstraints=null, HTTP.RESPONSE=com.ibm.ws.webcontainer31.srt.SRTServletResponse31@6dbe8fe3, org.apache.cxf.request.method=GET, org.apache.cxf.async.post.response.dispatch=true, org.apache.cxf.message.Message.IN_INTERCEPTORS=[org.apache.cxf.transport.https.CertConstraintsInterceptor@9a48f5f], HTTP_CONTEXT_MATCH_STRATEGY=stem, http.service.redirection=null, org.apache.cxf.message.Message.BASE_PATH=/MasterPartyServiceWeb/rest, path_to_match_slash=/masterparty/100511414/address/12345, org.apache.cxf.configuration.security.AuthorizationPolicy=org.apache.cxf.configuration.security.AuthorizationPolicy@d9d00296}, CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@c5e906a6], CamelCxfRsResponseClass=class javax.ws.rs.core.Response, CamelCxfRsResponseGenericType=class javax.ws.rs.core.Response, CamelHttpMethod=GET, CamelHttpPath=/masterparty/100511414/address/12345, CamelHttpUri=/MasterPartyServiceWeb/rest/masterparty/100511414/address/12345, connection=keep-alive, Content-Type=null, Host=localhost:9080, masterpartyId=100511414, operationName=getMasterPartyAddress, User-Agent=Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36}, BodyType: null, Body: [Body is null], Out: null: ] Test #2 - URI: http://localhost:9080/MasterPartyServiceWeb/rest/masterparty?firstName=tony Test #2 Exchange message - note - the CamelHttpQuery header's value is set to the query string, however, there is no "firstName" header present in the message. The "body" has been set to the value of the query parameter, though: 2016-04-06 08:39:28,581 [utor-thread-637] INFO TEST - Exchange[Id: ID-VDDK03P-6BB2764-57224-1459942270612-0-46, ExchangePattern: InOut, Properties: {CamelCorrelationId=ID-VDDK03P-6BB2764-57224-1459942270612-0-44, CamelCreatedTimestamp=Wed Apr 06 08:39:28 EDT 2016, CamelMessageHistory=[DefaultMessageHistory[routeId=route4, node=recipientList1], DefaultMessageHistory[routeId=route1, node=to1]], CamelMulticastComplete=true, CamelMulticastIndex=0, CamelRecipientListEndpoint=direct://findMasterParty_rest, CamelToEndpoint=log://TEST?showAll=true}, Headers: {Accept=*/*, accept-encoding=gzip, deflate, sdch, Accept-Language=en-US,en;q=0.8, Authorization=Basic bjAyODE0NTk6cTRtRTVBUWs=, breadcrumbId=ID-VDDK03P-6BB2764-57224-1459942270612-0-43, Cache-Control=no-cache, CamelAcceptContentType=*/*, CamelCxfMessage={org.apache.cxf.message.MessageFIXED_PARAMETER_ORDER=false, org.apache.cxf.resource.method=public javax.ws.rs.core.Response com.lmig.pi.masterpartyservice.rest.impl.MasterPartyResourceImpl.findMasterParty(java.lang.String), http.base.path=http://localhost:9080/MasterPartyServiceWeb, HTTP.REQUEST=com.ibm.ws.webcontainer31.srt.SRTServletRequest31@b2bdb1c7, org.apache.cxf.transport.Destination=org.apache.cxf.transport.servlet.ServletDestination@8953463e, HTTP.CONFIG=Servlet->null getClassName->org.apache.cxf.transport.servlet.CXFServlet getName->CXFServlet mapping->/* loadOnStartupWeight->1 getInitParameters->null or empty init parametersisAsyncSupported->false getDescription->null , jaxrs.template.parameters={FINAL_MATCH_GROUP=[/]}, org.apache.cxf.message.Message.QUERY_STRING=firstName=tony, org.apache.cxf.jaxrs.model.OperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@d02a2279], HTTP.CONTEXT=com.ibm.ws.webcontainer31.facade.ServletContextFacade31@ea9af9c4, Content-Type=null, org.apache.cxf.security.SecurityContext=org.apache.cxf.transport.http.AbstractHTTPDestination$2@e84d3103, org.apache.cxf.message.Message.PROTOCOL_HEADERS={Accept=[*/*], accept-encoding=[gzip, deflate, sdch], Accept-Language=[en-US,en;q=0.8], Authorization=[Basic bjAyODE0NTk6cTRtRTVBUWs=], Cache-Control=[no-cache], connection=[keep-alive], Content-Type=[null], Host=[localhost:9080], User-Agent=[Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36]}, org.apache.cxf.request.url=http://localhost:9080/MasterPartyServiceWeb/rest/masterparty, Accept=*/*, org.apache.cxf.request.uri=/MasterPartyServiceWeb/rest/masterparty, org.apache.cxf.message.Message.PATH_INFO=/MasterPartyServiceWeb/rest/masterparty, org.apache.cxf.transport.https.CertConstraints=null, HTTP.RESPONSE=com.ibm.ws.webcontainer31.srt.SRTServletResponse31@86c7d5e7, org.apache.cxf.request.method=GET, org.apache.cxf.async.post.response.dispatch=true, org.apache.cxf.message.Message.IN_INTERCEPTORS=[org.apache.cxf.transport.https.CertConstraintsInterceptor@9a48f5f], HTTP_CONTEXT_MATCH_STRATEGY=stem, http.service.redirection=null, org.apache.cxf.message.Message.BASE_PATH=/MasterPartyServiceWeb/rest, path_to_match_slash=/masterparty, org.apache.cxf.configuration.security.AuthorizationPolicy=org.apache.cxf.configuration.security.AuthorizationPolicy@e472867b}, CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@d02a2279], CamelCxfRsResponseClass=class javax.ws.rs.core.Response, CamelCxfRsResponseGenericType=class javax.ws.rs.core.Response, CamelHttpMethod=GET, CamelHttpPath=/masterparty, CamelHttpQuery=firstName=tony, CamelHttpUri=/MasterPartyServiceWeb/rest/masterparty, connection=keep-alive, Content-Type=null, Host=localhost:9080, operationName=findMasterParty, User-Agent=Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36}, BodyType: String, Body: tony, Out: null: ]