Sunday, September 19, 2010

How to get/set properties from/to JBI NMR within cxf se endpoint

As the typical way to use cxf se component in Apache Servicemix[1] or FuseSource[2] ESB is like
JBI consumer endpoint<=====> cxf se endpoint.Sometimes customer want to put extra properties during runtime in JBI NormalizedMessage with JBI consumer endpoint and retrieve it from cxf se endpoint later on.
With SMXCOMP-593[3], we provide a webservice friendly and CXF-ish way to retrieve and set properties in cxf se endpoint.
Customer just need add code like

    private WebServiceContext wsContext;
to inject WebServiceContext to this CxfSeEndpoint

and use ctx = wsContext.getMessageContext();
    org.apache.cxf.message.Message message = ((org.apache.cxf.jaxws.context.WrappedMessageContext) ctx).getWrappedMessage();
    String propertyValue = (String) message.get("PROPERTY_NAME");//retrieve property
    message.put("PROPERTY_NAME", "newPropertyValue");//set property

to get/set properties within cxf se endpoint.



  1. Wow what a nice post. I am impressed from it.

    Thanks for more sharing........


  2. Hi Fang,

    Do you have any sample Fuse project to demo the integration of hibernate with rest service .

    If you have can you please share the link