in soap-cxf/src/main/java/sample/camel/MyWsdlRouteBuilder.java [62:86]
public void configure() throws Exception {
// CustomerService is generated with cxf-codegen-plugin during the build
from("cxf:bean:customers")
.recipientList(simple("direct:${header.operationName}"));
from("direct:getCustomersByName").process(exchange -> {
String name = exchange.getIn().getBody(String.class);
MessageContentsList resultList = new MessageContentsList();
List<Customer> customersByName = customerRepository.getCustomersByName(name);
if (customersByName.isEmpty()) {
NoSuchCustomer noSuchCustomer = new NoSuchCustomer();
noSuchCustomer.setCustomerName(name);
throw new NoSuchCustomerException("Customer not found", noSuchCustomer);
}
resultList.add(customersByName);
exchange.getMessage().setBody(resultList);
});
from("direct:updateCustomer").process(exchange ->
customerRepository.updateCustomer(exchange.getIn().getBody(Customer.class)));
}