ElementInfo wrapperElement = wrapper.getOutputWrapperElement();
List<ElementInfo> childElements = wrapper.getOutputChildElements();
// If the source can be wrapped, wrapped it first
if (sourceWrapperHandler != null) {
DataType sourceWrapperType =
sourceWrapperHandler.getWrapperType(wrapperElement, childElements, context);
if (sourceWrapperType != null) {
Object sourceWrapper = sourceWrapperHandler.create(wrapperElement, context);
if (sourceWrapper != null) {
if (!childElements.isEmpty()) {
// Set the return value
ElementInfo returnElement = wrapper.getOutputChildElements().get(0);
sourceWrapperHandler.setChild(sourceWrapper, 0, returnElement, response);
}
Object targetWrapper =
mediator.mediate(sourceWrapper, sourceWrapperType, targetType.getLogical(), context
.getMetadata());
return targetWrapper;
}
}
}
Object targetWrapper = targetWrapperHandler.create(wrapper.getOutputWrapperElement(), context);
if (childElements.isEmpty()) {
// void output
return targetWrapper;
}
ElementInfo argElement = childElements.get(0);
DataType<XMLType> argType = wrapper.getUnwrappedOutputType();
Object child = response;
child = mediator.mediate(response, sourceType.getLogical(), argType, context.getMetadata());
targetWrapperHandler.setChild(targetWrapper, 0, argElement, child);
return targetWrapper;
} else if (sourceWrapped && (!targetWrapped)) {
// Wrapped to Unwrapped
Object sourceWrapper = response;
List<ElementInfo> childElements = sourceOp.getWrapper().getOutputChildElements();
if (childElements.isEmpty()) {
// The void output
return null;
}
if (targetWrapperHandler != null) {
ElementInfo wrapperElement = sourceOp.getWrapper().getOutputWrapperElement();
// FIXME: This is a workaround for the wsdless support as it passes in child elements
// under the wrapper that only matches by position
if (sourceWrapperHandler.isInstance(sourceWrapper, wrapperElement, childElements, context)) {
DataType targetWrapperType =
targetWrapperHandler.getWrapperType(wrapperElement, childElements, context);
if (targetWrapperType != null) {
Object targetWrapper =
mediator.mediate(sourceWrapper, sourceType.getLogical(), targetWrapperType, context
.getMetadata());