On Nov 1, 2007, at 6:44 AM, Barath wrote:


Hi,

i build one BC which listen to http://localhost:9090/ (using jetty server) and if any client requested, it ll send a hello world to browser. i am using
servlet for this. its working fine.

now i am tring to retrive a parameter from the request and normalize it and put it in message exchange and send to Myendpoint.java 's process method.

but i dono how to do that.
can u give any code explanation for the same.?

My class structure is

1 . MyBootstrap.java -- which listen to http:\\localhost:9090\ and calls
Servlet.java.
2 . Servlet.java -- doGet method calls join.java 's start method.
3 . join.java -- start method should call process method of Myendpoint.java
with MessageExchange as parameter.

I tried this code but dono how to initialize MessageExchangeFactory.

----------------------------8<-----------------------------------
            MyEndpoint endpoint= new MyEndpoint();
            InOut exchange;
            NormalizedMessage nm;
            MessageExchangeFactory exchangeFactory=
                
                try
                {
                exchange = exchangeFactory.createInOutExchange();
                nm = exchange.createMessage();

Here you also need to tell it where to go via exchange.setService() and, optionally, .setEndpoint().

                nm.setContent(new StringSource(inp));
                exchange.setInMessage(nm);
                endpoint.process(exchange);

Don't call endpoint.process.  You want to do this following instead:

channel.send( exchange ) or channel.sendSync( exchange )

That will get the message to your endpoint.

Make sure you have declared:

    @Resource
    private DeliveryChannel     channel;

In your bean class to have access to the channel.

HTH.


                }               
                catch( Exception ex)
                {
                        System.out.println(ex);
                        ex.printStackTrace();
                }
---------------------------------------8<----------------------------- -----------
Advanced Thanks,
Barath
--
View this message in context: http://www.nabble.com/to-add- normalized-message-to-MessageExchange------ tf4730489s12049.html#a13526388
Sent from the ServiceMix - User mailing list archive at Nabble.com.


--
Daryl
Email *my = [ daryl at: @"eddl" dot: @"us" ];
Weblog *blog = @”http://itsallsemantics.com”;



Reply via email to