interaction.setDocument(transformer.toDOMDocument(exchange.getMessage("in")));
msg.setPart(inputPartName, interaction);
EventDirector ed = ((BPEComponent) getServiceUnit().getComponent()).getEventDirector();
try {
IResponseMessage response;
try {
BPEEndpoint.setCurrent(this);
response = ed.sendEvent(msg, true);
} finally {
BPEEndpoint.setCurrent(null);
}
IInteraction payload = response.getPart(outputPartName);
if (response.getFault() != null) {
Exception e = response.getFault().getFaultException();
if (e != null) {
throw e;
}
// TODO: handle simple fault
throw new BPRuntimeException(response.getFault().getFaultString(), "");
} else if (exchange instanceof InOnly || exchange instanceof RobustInOnly) {
if (payload != null) {
throw new UnsupportedOperationException("Did not expect return value for in-only or robust-in-only");
}
exchange.setStatus(ExchangeStatus.DONE);