camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glen Mazza <glen.ma...@verizon.net>
Subject Re: Having a web service automatically activate when data is placed into a queue
Date Wed, 09 Apr 2008 09:49:01 GMT
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?

Thanks,
Glen



Am Mittwoch, den 09.04.2008, 12:48 +0800 schrieb Willem Jiang:
> Hi Glen,
> 
>  From your requirement , you need to start a "DoubleIt" web service your 
> self, maybe the same time that Camel context start.
> 
> Here is the code snippet for setting up the router.
> 
> from("test-jms:queue:test.queue").to("cxf://http://SERVICEADDRES?SEI=yourSEI...").to("file://test");
> 
> If you just feed the queue with a series of numbers,  you need to change 
> the message for the "DoubleIt" web service in a processer first.
> Here is an example[1] to show you how to make a web service call by 
> setting the message header with the Web service operation name , and 
> message body with the parameters. You can get the result from the 
> exchange.getOut().getBody(), which is a list.
> 
> [1]https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java
> 
> Willem.
> 
> 
> Glen Mazza wrote:
> > Hello,
> >
> > I'm trying to create a Camel example so I can learn more about the
> > product.  What I'd like to do is feed a queue a series of numbers, which
> > would automatically be fed as the lone parameter to a "DoubleIt" web
> > service, the output of which (i.e., the input number doubled in value)
> > would then be fed to a file.
> >
> > I understand how to write from a message queue to a file from this
> > example[1], and also, the camel-cxf example[2] gives me a pretty good
> > idea of how web service calls are made, but I'm not sure how to have a
> > web service automatically activated based on what is fed through a
> > queue; further, how to have the number that is fed into the queue serve
> > as the lone parameter to that web service call (which component, if any,
> > must occur between the queue and the web service so the number off the
> > queue is put into the SOAP request.)  Any guidance or known samples
> > would be appreciated.
> >
> > Thanks,
> > Glen  
> >
> > [1] http://activemq.apache.org/camel/walk-through-an-example.html
> > [2] http://activemq.apache.org/camel/cxf-example.html
> >
> >
> >
> >   
> 


Mime
View raw message