< prev index next >
jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/BodyImpl.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -34,10 +34,11 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
+import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
import org.w3c.dom.*;
import org.w3c.dom.Node;
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocument;
@@ -58,10 +59,14 @@
protected BodyImpl(SOAPDocumentImpl ownerDoc, NameImpl bodyName) {
super(ownerDoc, bodyName);
}
+ public BodyImpl(SOAPDocumentImpl ownerDoc, Element domElement) {
+ super(ownerDoc, domElement);
+ }
+
protected abstract NameImpl getFaultName(String name);
protected abstract boolean isFault(SOAPElement child);
protected abstract SOAPBodyElement createBodyElement(Name name);
protected abstract SOAPBodyElement createBodyElement(QName name);
protected abstract SOAPFault createFaultElement();
@@ -153,11 +158,11 @@
public SOAPFault getFault() {
if (hasFault()) {
if (fault == null) {
//initialize fault member
- fault = (SOAPFault) getFirstChildElement();
+ fault = (SOAPFault) getSoapDocument().find(getFirstChildElement());
}
return fault;
}
return null;
}
@@ -257,15 +262,16 @@
return newBodyElement;
//*/
}
protected SOAPElement convertToSoapElement(Element element) {
- if ((element instanceof SOAPBodyElement) &&
+ final Node soapNode = getSoapDocument().findIfPresent(element);
+ if ((soapNode instanceof SOAPBodyElement) &&
//this check is required because ElementImpl currently
// implements SOAPBodyElement
- !(element.getClass().equals(ElementImpl.class))) {
- return (SOAPElement) element;
+ !(soapNode.getClass().equals(ElementImpl.class))) {
+ return (SOAPElement) soapNode;
} else {
return replaceElementWithSOAPElement(
element,
(ElementImpl) createBodyElement(NameImpl
.copyElementName(element)));
@@ -312,11 +318,11 @@
throw new SOAPException("Cannot extract Document from body");
}
Document document = null;
try {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance("com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl", SAAJUtil.getSystemClassLoader());
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
document = builder.newDocument();
Element rootElement = (Element) document.importNode(
@@ -438,11 +444,11 @@
return staxBridge.getPayloadAttributeValue(attName);
} else {
//not lazy -Just get first child element and return its attribute
Element elem = getFirstChildElement();
if (elem != null) {
- return elem.getAttribute(localName);
+ return elem.getAttribute(getLocalName());
}
}
return null;
}
< prev index next >