"XML declaration parsing failed", e); String xmlDecl = ev.getXmlDeclaration(); if ((xmlDecl != null) && (xmlDecl.length() > 0)) { this.omitXmlDecl = false;
@Override protected Envelope createEnvelopeFromSource() throws SOAPException { // Record the presence of xml declaration before the envelope gets // created. XMLDeclarationParser parser = lookForXmlDecl(); Source tmp = source; source = null; EnvelopeImpl envelope = (EnvelopeImpl) EnvelopeFactory.createEnvelope(tmp, this); if (!envelope.getNamespaceURI().equals(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE)) { log.severe("SAAJ0304.ver1_1.msg.invalid.SOAP1.1"); throw new SOAPException("InputStream does not represent a valid SOAP 1.1 Message"); } if (parser != null && !omitXmlDecl) { envelope.setOmitXmlDecl("no"); envelope.setXmlDecl(parser.getXmlDeclaration()); envelope.setCharsetEncoding(parser.getEncoding()); } return envelope; }
@Override protected Envelope createEnvelopeFromSource() throws SOAPException { XMLDeclarationParser parser = lookForXmlDecl(); Source tmp = source; source = null; EnvelopeImpl envelope = (EnvelopeImpl)EnvelopeFactory.createEnvelope(tmp, this); if (!envelope.getNamespaceURI().equals(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE)) { log.severe("SAAJ0415.ver1_2.msg.invalid.soap1.2"); throw new SOAPException("InputStream does not represent a valid SOAP 1.2 Message"); } if (parser != null) { //can be null if source was a DomSource and not StreamSource if (!omitXmlDecl) { envelope.setOmitXmlDecl("no"); envelope.setXmlDecl(parser.getXmlDeclaration()); envelope.setCharsetEncoding(parser.getEncoding()); } } return envelope; }