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\""); } } }
contentType.toString(), getExpectedContentType()}); throw new SOAPVersionMismatchException( "Cannot create message: incorrect content-type for SOAP version. Got: " + contentType