public void execute(ActivityExecution execution) throws Exception {
MessageInstance message;
if (ioSpecification != null) {
this.ioSpecification.initialize(execution);
ItemInstance inputItem = (ItemInstance) execution.getVariable(this.ioSpecification.getFirstDataInputName());
message = new MessageInstance(this.operation.getInMessage(), inputItem);
} else {
message = this.operation.getInMessage().createInstance();
}
execution.setVariable(CURRENT_MESSAGE, message);
this.fillMessage(message, execution);
MessageInstance receivedMessage = this.operation.sendMessage(message);
execution.setVariable(CURRENT_MESSAGE, receivedMessage);
if (ioSpecification != null) {
String firstDataOutputName = this.ioSpecification.getFirstDataOutputName();
if (firstDataOutputName != null) {
ItemInstance outputItem = (ItemInstance) execution.getVariable(firstDataOutputName);
outputItem.getStructureInstance().loadFrom(receivedMessage.getStructureInstance().toArray());
}
}
this.returnMessage(receivedMessage, execution);