// RULE No.4 and No5:
// wrapper element should be pure complex type
// Now lets see if we have any attributes...
// This should probably look at the restricted and substitute types too.
OperationInfo unwrapped = new UnwrappedOperationInfo(opInfo);
MessageInfo unwrappedInput = new MessageInfo(unwrapped, MessageInfo.Type.INPUT,
inputMessage.getName());
MessageInfo unwrappedOutput = null;
XmlSchemaComplexType xsct = null;
if (inputEl.getSchemaType() instanceof XmlSchemaComplexType) {
xsct = (XmlSchemaComplexType)inputEl.getSchemaType();
if (hasAttributes(xsct)
|| (inputEl.isNillable() && !relaxed)
|| !isWrappableSequence(xsct, inputEl.getQName().getNamespaceURI(),
unwrappedInput, allowRefs)) {
passedRule = false;
}
} else {
passedRule = false;
}
if (!passedRule) {
org.apache.cxf.common.i18n.Message message
= new org.apache.cxf.common.i18n.Message("WRAPPED_RULE_4", LOG, opInfo.getName());
LOG.log(logLevel, message.toString());
return;
}
if (outputMessage != null) {
unwrappedOutput = new MessageInfo(unwrapped, MessageInfo.Type.OUTPUT, outputMessage.getName());
if (outputEl != null && outputEl.getSchemaType() instanceof XmlSchemaComplexType) {
xsct = (XmlSchemaComplexType)outputEl.getSchemaType();
if (xsct.isAbstract()) {
passedRule = false;
}
if (hasAttributes(xsct)
|| (outputEl.isNillable() && !relaxed)
|| !isWrappableSequence(xsct, outputEl.getQName().getNamespaceURI(), unwrappedOutput,
allowRefs)) {
passedRule = false;
}
} else {
passedRule = false;
}
}
if (!passedRule) {
org.apache.cxf.common.i18n.Message message
= new org.apache.cxf.common.i18n.Message("WRAPPED_RULE_5", LOG, opInfo.getName());
LOG.log(logLevel, message.toString());
return;
}
// we are wrappable!!
opInfo.setUnwrappedOperation(unwrapped);
unwrapped.setInput(opInfo.getInputName(), unwrappedInput);
if (outputMessage != null) {
unwrapped.setOutput(opInfo.getOutputName(), unwrappedOutput);
}
}