com.sun.xml.internal.messaging.saaj.soap.impl.ElementImpl Java Examples

The following examples show how to use com.sun.xml.internal.messaging.saaj.soap.impl.ElementImpl. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SOAPPartImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
protected void lookForEnvelope() throws SOAPException {
    Element envelopeChildElement = document.doGetDocumentElement();
    if (envelopeChildElement == null || envelopeChildElement instanceof Envelope) {
        envelope = (EnvelopeImpl) envelopeChildElement;
    } else if (!(envelopeChildElement instanceof ElementImpl)) {
        log.severe("SAAJ0512.soap.incorrect.factory.used");
        throw new SOAPExceptionImpl("Unable to create envelope: incorrect factory used during tree construction");
    } else {
        ElementImpl soapElement = (ElementImpl) envelopeChildElement;
        if (soapElement.getLocalName().equalsIgnoreCase("Envelope")) {
            String prefix = soapElement.getPrefix();
            String uri = (prefix == null) ? soapElement.getNamespaceURI() : soapElement.getNamespaceURI(prefix);
            if(!uri.equals(NameImpl.SOAP11_NAMESPACE) && !uri.equals(NameImpl.SOAP12_NAMESPACE)) {
                log.severe("SAAJ0513.soap.unknown.ns");
                throw new SOAPVersionMismatchException("Unable to create envelope from given source because the namespace was not recognized");
            }
        } else {
            log.severe("SAAJ0514.soap.root.elem.not.named.envelope");
            throw new SOAPExceptionImpl(
                "Unable to create envelope from given source because the root element is not named \"Envelope\"");
        }
    }
}
 
Example #2
Source File: SOAPPartImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
protected void lookForEnvelope() throws SOAPException {
    Element envelopeChildElement = document.doGetDocumentElement();
    if (envelopeChildElement == null || envelopeChildElement instanceof Envelope) {
        envelope = (EnvelopeImpl) envelopeChildElement;
    } else if (!(envelopeChildElement instanceof ElementImpl)) {
        log.severe("SAAJ0512.soap.incorrect.factory.used");
        throw new SOAPExceptionImpl("Unable to create envelope: incorrect factory used during tree construction");
    } else {
        ElementImpl soapElement = (ElementImpl) envelopeChildElement;
        if (soapElement.getLocalName().equalsIgnoreCase("Envelope")) {
            String prefix = soapElement.getPrefix();
            String uri = (prefix == null) ? soapElement.getNamespaceURI() : soapElement.getNamespaceURI(prefix);
            if(!uri.equals(NameImpl.SOAP11_NAMESPACE) && !uri.equals(NameImpl.SOAP12_NAMESPACE)) {
                log.severe("SAAJ0513.soap.unknown.ns");
                throw new SOAPVersionMismatchException("Unable to create envelope from given source because the namespace was not recognized");
            }
        } else {
            log.severe("SAAJ0514.soap.root.elem.not.named.envelope");
            throw new SOAPExceptionImpl(
                "Unable to create envelope from given source because the root element is not named \"Envelope\"");
        }
    }
}
 
Example #3
Source File: SOAPPartImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
protected void lookForEnvelope() throws SOAPException {
    Element envelopeChildElement = document.doGetDocumentElement();
    if (envelopeChildElement == null || envelopeChildElement instanceof Envelope) {
        envelope = (EnvelopeImpl) envelopeChildElement;
    } else if (!(envelopeChildElement instanceof ElementImpl)) {
        log.severe("SAAJ0512.soap.incorrect.factory.used");
        throw new SOAPExceptionImpl("Unable to create envelope: incorrect factory used during tree construction");
    } else {
        ElementImpl soapElement = (ElementImpl) envelopeChildElement;
        if (soapElement.getLocalName().equalsIgnoreCase("Envelope")) {
            String prefix = soapElement.getPrefix();
            String uri = (prefix == null) ? soapElement.getNamespaceURI() : soapElement.getNamespaceURI(prefix);
            if(!uri.equals(NameImpl.SOAP11_NAMESPACE) && !uri.equals(NameImpl.SOAP12_NAMESPACE)) {
                log.severe("SAAJ0513.soap.unknown.ns");
                throw new SOAPVersionMismatchException("Unable to create envelope from given source because the namespace was not recognized");
            }
        } else {
            log.severe("SAAJ0514.soap.root.elem.not.named.envelope");
            throw new SOAPExceptionImpl(
                "Unable to create envelope from given source because the root element is not named \"Envelope\"");
        }
    }
}
 
Example #4
Source File: SOAPPartImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
protected void lookForEnvelope() throws SOAPException {
    Element envelopeChildElement = document.doGetDocumentElement();
    if (envelopeChildElement == null || envelopeChildElement instanceof Envelope) {
        envelope = (EnvelopeImpl) envelopeChildElement;
    } else if (!(envelopeChildElement instanceof ElementImpl)) {
        log.severe("SAAJ0512.soap.incorrect.factory.used");
        throw new SOAPExceptionImpl("Unable to create envelope: incorrect factory used during tree construction");
    } else {
        ElementImpl soapElement = (ElementImpl) envelopeChildElement;
        if (soapElement.getLocalName().equalsIgnoreCase("Envelope")) {
            String prefix = soapElement.getPrefix();
            String uri = (prefix == null) ? soapElement.getNamespaceURI() : soapElement.getNamespaceURI(prefix);
            if(!uri.equals(NameImpl.SOAP11_NAMESPACE) && !uri.equals(NameImpl.SOAP12_NAMESPACE)) {
                log.severe("SAAJ0513.soap.unknown.ns");
                throw new SOAPVersionMismatchException("Unable to create envelope from given source because the namespace was not recognized");
            }
        } else {
            log.severe("SAAJ0514.soap.root.elem.not.named.envelope");
            throw new SOAPExceptionImpl(
                "Unable to create envelope from given source because the root element is not named \"Envelope\"");
        }
    }
}
 
Example #5
Source File: SOAPPartImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
protected void lookForEnvelope() throws SOAPException {
    Element envelopeChildElement = document.doGetDocumentElement();
    org.w3c.dom.Node soapEnvelope = document.findIfPresent(envelopeChildElement);
    if (soapEnvelope == null || soapEnvelope instanceof Envelope) {
        envelope = (EnvelopeImpl) soapEnvelope;
    } else if (document.find(envelopeChildElement) == null) {
        log.severe("SAAJ0512.soap.incorrect.factory.used");
        throw new SOAPExceptionImpl("Unable to create envelope: incorrect factory used during tree construction");
    } else {
        ElementImpl soapElement = (ElementImpl) document.find(envelopeChildElement);
        if (soapElement.getLocalName().equalsIgnoreCase("Envelope")) {
            String prefix = soapElement.getPrefix();
            String uri = (prefix == null) ? soapElement.getNamespaceURI() : soapElement.getNamespaceURI(prefix);
            if(!uri.equals(NameImpl.SOAP11_NAMESPACE) && !uri.equals(NameImpl.SOAP12_NAMESPACE)) {
                log.severe("SAAJ0513.soap.unknown.ns");
                throw new SOAPVersionMismatchException("Unable to create envelope from given source because the namespace was not recognized");
            }
        } else {
            log.severe("SAAJ0514.soap.root.elem.not.named.envelope");
            throw new SOAPExceptionImpl(
                "Unable to create envelope from given source because the root element is not named \"Envelope\"");
        }
    }
}
 
Example #6
Source File: SOAPDocumentImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Attr createAttribute(String name) throws DOMException {
    boolean isQualifiedName = (name.indexOf(":") > 0);
    if (isQualifiedName) {
        String nsUri = null;
        String prefix = name.substring(0, name.indexOf(":"));
        //cannot do anything to resolve the URI if prefix is not
        //XMLNS.
        if (XMLNS.equals(prefix)) {
            nsUri = ElementImpl.XMLNS_URI;
            return createAttributeNS(nsUri, name);
        }
    }

    return document.createAttribute(name);
}
 
Example #7
Source File: SOAPPartImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
protected void lookForEnvelope() throws SOAPException {
    Element envelopeChildElement = document.doGetDocumentElement();
    if (envelopeChildElement == null || envelopeChildElement instanceof Envelope) {
        envelope = (EnvelopeImpl) envelopeChildElement;
    } else if (!(envelopeChildElement instanceof ElementImpl)) {
        log.severe("SAAJ0512.soap.incorrect.factory.used");
        throw new SOAPExceptionImpl("Unable to create envelope: incorrect factory used during tree construction");
    } else {
        ElementImpl soapElement = (ElementImpl) envelopeChildElement;
        if (soapElement.getLocalName().equalsIgnoreCase("Envelope")) {
            String prefix = soapElement.getPrefix();
            String uri = (prefix == null) ? soapElement.getNamespaceURI() : soapElement.getNamespaceURI(prefix);
            if(!uri.equals(NameImpl.SOAP11_NAMESPACE) && !uri.equals(NameImpl.SOAP12_NAMESPACE)) {
                log.severe("SAAJ0513.soap.unknown.ns");
                throw new SOAPVersionMismatchException("Unable to create envelope from given source because the namespace was not recognized");
            }
        } else {
            log.severe("SAAJ0514.soap.root.elem.not.named.envelope");
            throw new SOAPExceptionImpl(
                "Unable to create envelope from given source because the root element is not named \"Envelope\"");
        }
    }
}
 
Example #8
Source File: SOAPPartImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
protected void lookForEnvelope() throws SOAPException {
    Element envelopeChildElement = document.doGetDocumentElement();
    if (envelopeChildElement == null || envelopeChildElement instanceof Envelope) {
        envelope = (EnvelopeImpl) envelopeChildElement;
    } else if (!(envelopeChildElement instanceof ElementImpl)) {
        log.severe("SAAJ0512.soap.incorrect.factory.used");
        throw new SOAPExceptionImpl("Unable to create envelope: incorrect factory used during tree construction");
    } else {
        ElementImpl soapElement = (ElementImpl) envelopeChildElement;
        if (soapElement.getLocalName().equalsIgnoreCase("Envelope")) {
            String prefix = soapElement.getPrefix();
            String uri = (prefix == null) ? soapElement.getNamespaceURI() : soapElement.getNamespaceURI(prefix);
            if(!uri.equals(NameImpl.SOAP11_NAMESPACE) && !uri.equals(NameImpl.SOAP12_NAMESPACE)) {
                log.severe("SAAJ0513.soap.unknown.ns");
                throw new SOAPVersionMismatchException("Unable to create envelope from given source because the namespace was not recognized");
            }
        } else {
            log.severe("SAAJ0514.soap.root.elem.not.named.envelope");
            throw new SOAPExceptionImpl(
                "Unable to create envelope from given source because the root element is not named \"Envelope\"");
        }
    }
}
 
Example #9
Source File: SOAPPartImpl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
protected void lookForEnvelope() throws SOAPException {
    Element envelopeChildElement = document.doGetDocumentElement();
    if (envelopeChildElement == null || envelopeChildElement instanceof Envelope) {
        envelope = (EnvelopeImpl) envelopeChildElement;
    } else if (!(envelopeChildElement instanceof ElementImpl)) {
        log.severe("SAAJ0512.soap.incorrect.factory.used");
        throw new SOAPExceptionImpl("Unable to create envelope: incorrect factory used during tree construction");
    } else {
        ElementImpl soapElement = (ElementImpl) envelopeChildElement;
        if (soapElement.getLocalName().equalsIgnoreCase("Envelope")) {
            String prefix = soapElement.getPrefix();
            String uri = (prefix == null) ? soapElement.getNamespaceURI() : soapElement.getNamespaceURI(prefix);
            if(!uri.equals(NameImpl.SOAP11_NAMESPACE) && !uri.equals(NameImpl.SOAP12_NAMESPACE)) {
                log.severe("SAAJ0513.soap.unknown.ns");
                throw new SOAPVersionMismatchException("Unable to create envelope from given source because the namespace was not recognized");
            }
        } else {
            log.severe("SAAJ0514.soap.root.elem.not.named.envelope");
            throw new SOAPExceptionImpl(
                "Unable to create envelope from given source because the root element is not named \"Envelope\"");
        }
    }
}
 
Example #10
Source File: SOAPDocumentImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Extracts w3c dom node from corresponding soap wrapper.
 *
 * @param node soap or dom nullable
 * @return dom node
 */
public Node getDomNode(Node node) {
    if (node instanceof SOAPDocumentImpl) {
        return ((SOAPDocumentImpl)node).getDomElement();
    } else if (node instanceof ElementImpl) {
        return ((ElementImpl) node).getDomElement();
    } else if (node instanceof SOAPTextImpl) {
        return ((SOAPTextImpl)node).getDomElement();
    } else if (node instanceof SOAPCommentImpl) {
        return ((SOAPCommentImpl)node).getDomElement();
    } else if (node instanceof CDATAImpl) {
        return ((CDATAImpl) node).getDomElement();
    }
    return node;
}