Hi all, i have a servlet that works on SOAP 1.1 Message , but usually doesn't need to access to soap:Body content. i obtain an org.apache.axiom.soap.impl.dom.SOAPMessageImpl in this way:
XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance().createXMLStreamReader(((HttpServletRequest) req).getInputStream()); org.apache.axiom.soap.SOAPFactory mf = new org.apache.axiom.soap.impl.dom.soap11.SOAP11Factory(); org.apache.axiom.om.OMXMLParserWrapper parser = new StAXSOAPModelBuilder(xmlStreamReader,mf,null); org.apache.axiom.soap.impl.dom.SOAPMessageImpl soapMessage = (org.apache.axiom.soap.impl.dom.SOAPMessageImpl) ((StAXSOAPModelBuilder)parser).getSoapMessage(); then i tryed to add an HeaderBlock, but if i call method serialize() on the header several times, only first time i can see new HeaderBlock, then i'll loose it. After some tests i'll find that if i call build() method on the header element: soapMessage.getEnvelope().getHeader().build() and i add new HeaderBlock, i can serialize the message header many times without loosing new added HeaderBlock elements and without building the message Body using very few memory. Now the problem: what if the message hasn't the Header element? soapMessage.getEnvelope().getHeader() is null I have to add a new Header, but if i don't call the build() on the Envelope i'll loose it first time i serialize it and if i build the envelope, i'll build also the Body with a huge memory load. There is a solution without building the entire soap:Body element? Thanks in advance for any help, - Lorenzo
