Hi,

I can reproduce the error by add a simple unit test for the cxfrs route, so I create a JIRA CAMEL-3860 of it.

Just one more note, it is not a good idea to use camel-cxfrs build a proxy is you don't change the request, as you can simple use camel-jetty and camel-http to a simple http proxy.

[1]https://issues.apache.org/jira/browse/CAMEL-3860

Willem

On 4/14/11 6:55 AM, robinhowlett wrote:
In my context.xml I have defined a jaxrs:server with serviceBean referenced,
and both a cxf:rsServer and cxf:rsClient.


        
                
        










        


My route is defined in RestTestRouteBuilder using Java DSL and is just:

from("cxfrs://bean://rsServer").to("cxfrs://bean//rsClient");

My test case is using the producerTemplate to send to the cxfrs endpoint
defined by the cxf:rsServer and I include query parameters. A Processor sets
the ExchangePattern as InOut, and the inMessage has a HTTP_METHOD header set
to "GET" and a Response Class header to InputStream

Exchange exchange =
template.send("cxfrs://http://localhost:9000/route/test/query?httpClientAPI=true&id=12&orgId=34";,
new Processor() {
                 public void process(Exchange exchange) throws Exception {
                     exchange.setPattern(ExchangePattern.InOut);
                     Message inMessage = exchange.getIn();
                     inMessage.setHeader(Exchange.HTTP_METHOD, "GET");

inMessage.setHeader(CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS,
InputStream.class);
                     inMessage.setBody(null);
         }

});

String response = exchange.getOut().getBody(String.class);
assertNotNull("The response should not be null ", response);
assertEquals("The response value is incorrect", "test", response);

My CXF service bean has paths set correctly and my "query" method is
expecting two @QueryParams

@Path("/test")
public class QueryService {
...
         @GET
        @Path("/query")
        public Response getSomething(@QueryParam("id") String id,
@QueryParam("orgId") String orgId) {
                System.out.println(id);
                System.out.println(orgId);
                return "test";
        }
...
}

However when I run the test, the QueryParams are receving nothing (null);
after many tries, I realized that the parameters that were set on the URL
are actually coming in as of type @HeaderParam
...
         @GET
        @Path("/query")
        public Response getSomething(@HeaderParam("id") String id,
@HeaderParam("orgId") String orgId) {
                System.out.println(id);
                System.out.println(orgId);
                return "test";
        }
...

What's happening to convert those to type @HeaderParam and how can I get
them as of type @QueryParam?

--
View this message in context: 
http://camel.465427.n5.nabble.com/CXF-RS-QueryParam-and-HeaderParam-tp4301808p4301808.html
Sent from the Camel - Users mailing list archive at Nabble.com.



--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang

Connect at CamelOne May 24-26
The Open Source Integration Conference
http://camelone.com

Reply via email to