if (outputParts.size() == 0) {
addVoidReturn(method);
return;
}
MessagePartInfo inputPart = inputParts.size() > 0 ? inputParts.iterator().next() : null;
MessagePartInfo outputPart = outputParts.size() > 0 ? outputParts.iterator().next() : null;
List<QName> inputWrapElement = null;
List<QName> outputWrapElement = null;
if (inputPart != null) {
inputWrapElement = ProcessorUtil.getWrappedElementQNames(context, inputPart.getElementQName());
}
if (outputPart != null) {
outputWrapElement = ProcessorUtil.getWrappedElementQNames(context, outputPart.getElementQName());
}
if (inputWrapElement == null || outputWrapElement.size() == 0) {
addVoidReturn(method);
return;
}
method.setReturn(null);
boolean qualified = ProcessorUtil.isSchemaFormQualified(context, outputPart.getElementQName());
if (outputWrapElement.size() == 1 && inputWrapElement != null) {
QName outElement = outputWrapElement.iterator().next();
boolean sameWrapperChild = false;
for (QName inElement : inputWrapElement) {
if (isSameWrapperChild(inElement, outElement)) {
JavaParameter jp = getParameterFromQName(outputPart.getElementQName(), outElement,
JavaType.Style.INOUT, outputPart);
if (!qualified) {
jp.setTargetNamespace("");
}
addParameter(method, jp);
sameWrapperChild = true;
if (method.getReturn() == null) {
addVoidReturn(method);
}
break;
}
}
if (!sameWrapperChild) {
JavaReturn jreturn = getReturnFromQName(outElement, outputPart);
if (!qualified) {
jreturn.setTargetNamespace("");
}
method.setReturn(jreturn);
return;
}
}
for (QName outElement : outputWrapElement) {
if ("return".equals(outElement.getLocalPart())) {
if (method.getReturn() != null) {
org.apache.cxf.common.i18n.Message msg =
new org.apache.cxf.common.i18n.Message("WRAPPER_STYLE_TWO_RETURN_TYPES", LOG);
throw new ToolException(msg);
}
JavaReturn jreturn = getReturnFromQName(outElement, outputPart);
if (!qualified) {
jreturn.setTargetNamespace("");
}
method.setReturn(jreturn);
continue;
}
boolean sameWrapperChild = false;
if (inputWrapElement != null) {
for (QName inElement : inputWrapElement) {
if (isSameWrapperChild(inElement, outElement)) {
JavaParameter jp = getParameterFromQName(outputPart.getElementQName(), outElement,
JavaType.Style.INOUT, outputPart);
if (!qualified) {
jp.setTargetNamespace("");
}
addParameter(method, jp);
sameWrapperChild = true;
break;
}
}
}
if (!sameWrapperChild) {
JavaParameter jp = getParameterFromQName(outputPart.getElementQName(), outElement,
JavaType.Style.OUT, outputPart);
if (!qualified) {
jp.setTargetNamespace("");
}
addParameter(method, jp);