private void addReturnWrapperRoot(XMLMessage xmlMessage,
DataBindingCallback callback) throws WSDLException {
BindingOperation operation = getBindingOperation(callback.getOperationName());
BindingOutput output = operation.getBindingOutput();
TBody xmlBinding = null;
Iterator ite = output.getExtensibilityElements().iterator();
while (ite.hasNext()) {
Object obj = ite.next();
if (obj instanceof TBody) {
xmlBinding = (TBody)obj;
}
}
if (needRootNode(operation, true)) {
if (xmlBinding == null || xmlBinding.getRootNode() == null) {
throw new XMLBindingException("Bare style must define the rootNode in this case!");
}
QName rootNode = xmlBinding.getRootNode();
Document doc = xmlMessage.getRoot();
String targetNamespace = rootNode.getNamespaceURI() == null
? callback.getTargetNamespace() : rootNode.getNamespaceURI();
Element operationNode = doc.createElementNS(targetNamespace, rootNode.getLocalPart());
xmlMessage.appendChild(operationNode);