if (context == null)
throw new RuntimeException("Context passed was NULL.");
SendingResultDocument activity = SendingResultDocument.Factory.newInstance();
ResultResponderType activityType = activity.addNewSendingResult();
// set the receiver to the remote entity
if (context.getRemoteEntity() != null) {
activityType.addNewReceiver().set(context.getRemoteEntity().toBaseIDType());
} else {
logger.warn("Possible Error in context that was passed. "
+ "There was no remote entity defined (responseReceiver=NULL)");
}
// add header and body fields
if (header != null || body != null) {
InvocationMessageType result = activityType.addNewResult();
if (header != null)
result.addNewHeader().set(header);
if (body != null)
result.addNewBody().set(body);
}