if (webMethod != null && webMethod.action() != null) {
soapAction = webMethod.action();
}
}
Body body = new Body();
Header header = new Header();
Throwable exception = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Throwable.class);
if (exception == null) {
exception = exchange.getIn().getHeader(Exchange.EXCEPTION_CAUGHT, Throwable.class);
}
final List<JAXBElement<?>> bodyContent;
List<JAXBElement<?>> headerContent = new ArrayList<JAXBElement<?>>();
if (exception != null) {
bodyContent = new ArrayList<JAXBElement<?>>();
bodyContent.add(createFaultFromException(exception));
} else {
bodyContent = createContentFromObject(inputObject, soapAction, headerContent);
}
for (JAXBElement<?> elem : bodyContent) {
body.getAny().add(elem);
}
for (JAXBElement<?> elem : headerContent) {
header.getAny().add(elem);
}
Envelope envelope = new Envelope();