On 09/04/2008, Glen Mazza <[EMAIL PROTECTED]> wrote:
> Thanks Willem, one more question, looking at the sample code you linked
> to below:
>
> public void testInvokingJawsServerWithParams() throws Exception {
> CxfExchange exchange =
> (CxfExchange)template.send(getJaxwsEndpointUri(), new Processor() {
> public void process(final Exchange exchange) {
> final List<String> params = new ArrayList<String>();
> params.add(TEST_MESSAGE);
> exchange.getIn().setBody(params);
> exchange.getIn().setHeader(CxfConstants.OPERATION_NAME,
> GREET_ME_OPERATION);
> }
> });
>
> org.apache.camel.Message out = exchange.getOut();
> Object[] output = (Object[])out.getBody();
> LOG.info("Received output text: " + output[0]);
> assertEquals("reply body on Camel", "Hello " + TEST_MESSAGE,
> output[0]);
> }
>
> The "params" in "exchange.getIn().setBody(params);" above will come from
> the numbers being fed to the queue, with one web service call for each
> number fed in. But how can I access (obtain) the numbers being fed into
> the queue from within that process(final Exchange exchange) override
> above?
You can access the parameters (i.e. message body) via
exchange.getIn().getBody();
if you want to try convert the body to a certain Java type, such as a String...
String body = exchange.getIn().getBody(String.class);
This will then invoke the type converter mechanism to try convert to
the correct type (or return null if it could not be converted).
http://activemq.apache.org/camel/type-converter.html
--
James
-------
http://macstrac.blogspot.com/
Open Source Integration
http://open.iona.com