I got a RouteBuilder processing Jaxb messages. The SoapJaxbDataFormat in this example is set to a fixed jaxbPackage and elementNameStrategy. Is it possible to dynamically create the SoapJaxbDataFormat based on the Exchange, so the jaxbPackage and elementNameStrategy are instanciated based on the in object?
public void configure() throws Exception { String jaxbPackage = ListOfCurrenciesByName.class.getPackage().getName(); ElementNameStrategy elementNameStrategy = new ServiceInterfaceStrategy(CountryInfoServiceSoapType.class, true); SoapJaxbDataFormat soapJaxbDataFormat = new SoapJaxbDataFormat(jaxbPackage, elementNameStrategy); soapJaxbDataFormat.setFragment(true); String WS_URI = "http://localhost:9999/websamples.countryinfo/CountryInfoService.wso"; from("direct:countryInfo") .marshal(soapJaxbDataFormat) .setHeader(CacheConstants.CACHE_OPERATION, constant(CacheConstants.CACHE_OPERATION_GET)) .setHeader(CacheConstants.CACHE_KEY, body()) .to("cache://TestCache1") .choice().when(header(CacheConstants.CACHE_ELEMENT_WAS_FOUND).isNull()) .setHeader(CacheConstants.CACHE_KEY, body()) .setHeader(Exchange.HTTP_METHOD, constant("POST")) .setHeader(Exchange.CONTENT_TYPE, constant("text/xml")) .setHeader(Exchange.CONTENT_ENCODING, constant("utf-8")) .to(WS_URI) .unmarshal(soapJaxbDataFormat) .setHeader(CacheConstants.CACHE_OPERATION, constant(CacheConstants.CACHE_OPERATION_ADD)) .to("cache://TestCache1") .end(); } -- View this message in context: http://camel.465427.n5.nabble.com/Dynamic-DataFormat-in-RouteBuilder-tp5746738.html Sent from the Camel - Users mailing list archive at Nabble.com.