DetachableInputStream is = new DetachableInputStream(inputStream); messageContext.setProperty(Constants.DETACHABLE_INPUT_STREAM, is);
InputStream getInputStream(boolean preserve) throws IOException { if (!preserve && state == STATE_UNREAD) { checkParserState(parser.getState(), EntityState.T_BODY); state = STATE_STREAMING; detachableInputStream = new DetachableInputStream(getDecodedInputStream()); return detachableInputStream; } else { WritableBlob content = getContent(); if (preserve) { return content.getInputStream(); } else if (content instanceof MemoryBlob) { return ((MemoryBlob)content).readOnce(); } else { return new ReadOnceInputStreamWrapper(this, content.getInputStream()); } } }
public OMElement processDocument(InputStream inputStream, String contentType, MessageContext messageContext) throws AxisFault { try { String charSetEncoding = (String) messageContext .getProperty(Constants.Configuration.CHARACTER_SET_ENCODING); // Apply a detachable inputstream. This can be used later // to (a) get the length of the incoming message or (b) // free transport resources. DetachableInputStream is = new DetachableInputStream(inputStream); messageContext.setProperty(Constants.DETACHABLE_INPUT_STREAM, is); // createSOAPModelBuilder takes care of configuring the underlying parser to // avoid the security issue described in CVE-2010-1632 OMXMLParserWrapper builder = OMXMLBuilderFactory.createSOAPModelBuilder(is, charSetEncoding); SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement(); BuilderUtil .validateSOAPVersion(BuilderUtil.getEnvelopeNamespace(contentType), envelope); BuilderUtil.validateCharSetEncoding(charSetEncoding, builder.getDocument() .getCharsetEncoding(), envelope.getNamespace().getNamespaceURI()); return envelope; } catch (IOException e) { throw AxisFault.makeFault(e); } }
filterIS = new DetachableInputStream(inStream); is = filterIS; } else {