if (op.getWrapper() != null) {
outputMsg.addPart(generateWrapperPart(definition, op, helpers, wrappers, false));
} else {
if ((op.getOutputType() != null) && ( op.getOutputType().getLogical().size() != 0)) {
DataType outputType = op.getOutputType().getLogical().get(0);
outputMsg.addPart(generatePart(definition, outputType, "return"));
elements = new ArrayList<ElementInfo>();
ElementInfo element = getElementInfo(outputType.getPhysical(), outputType, null, helpers);
elements.add(element);
QName elementName = ((XMLType)outputType.getLogical()).getElementName();
wrappers.put(elementName, elements);
}
}
output.setMessage(outputMsg);
operation.setOutput(output);
operation.setStyle(OperationType.REQUEST_RESPONSE);
} else {
operation.setStyle(OperationType.ONE_WAY);
}
for (DataType<DataType> faultType: op.getFaultTypes()) {
Fault fault = definition.createFault();
// TUSCANY-3778 - use the definition namespace not the element namespace to create the fault message
QName faultName = ((XMLType)faultType.getLogical().getLogical()).getElementName();
QName faultMsgName = new QName(namespaceURI, faultName.getLocalPart());
fault.setName(faultName.getLocalPart());
Message faultMsg = definition.getMessage(faultMsgName);
if (faultMsg == null) {
faultMsg = definition.createMessage();
faultMsg.setQName(faultMsgName);
faultMsg.setUndefined(false);
definition.addMessage(faultMsg);
faultMsg.addPart(generatePart(definition, faultType.getLogical(), faultName.getLocalPart()));
}
fault.setMessage(faultMsg);
operation.addFault(fault);
if (faultType.getLogical().getPhysical() != faultType.getPhysical()) {
// create special wrapper for type indirection to real fault bean
DataType logical = faultType.getLogical();
elements = new ArrayList<ElementInfo>();
elements.add(getElementInfo(logical.getPhysical(), logical, null, helpers));
} else {
// convert synthesized fault bean to a wrapper type
for (DataType<XMLType> propDT: op.getFaultBeans().get(faultName)) {
XMLType logical = propDT.getLogical();
elements = new ArrayList<ElementInfo>();
elements.add(getElementInfo(propDT.getPhysical(), propDT, logical.getElementName(), helpers));
}
}
wrappers.put(faultName, elements);
}