You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Frembs Michael <re...@michaelfrembs.de> on 2013/08/16 12:40:16 UTC

Problem with SOAPMessage and Comments

Hi,
 
I try to get a webservice working with MTOM enabled and validation. The inbuild
validation doesn't work for that kind of szenario (I getting a system out of
memory, because JAXB is loading the complete attachment). So I tried a new way.
I use a Interceptor which gets me a javax.xml.soap.SOAPMessage (or its body I'm
validating) out of a org.apache.cxf.binding.soap.SoapMessage:
 
    private SOAPBody getSoapBody(final SoapMessage message) throws IOException,
SOAPException {
        SOAPMessage soapMessage = message.getContent(SOAPMessage.class);
        if (soapMessage == null) {
            saajIn.handleMessage(message);
            soapMessage = message.getContent(SOAPMessage.class);
        }
        //soapMessage.writeTo(System.err);
        return soapMessage.getSOAPBody();
    }
 
Everything works fine as long I don't put comments in the request. As soon as I
put a comment in the request the validation fails, because "<!--" and "-->" are
deleted of the message but the comment itself is still there:
 
SOAPMessage (sent by soapUI):
//...
<xplg:InputData bytes="1349" /><!-- Die Groesse der Nutzdaten
                    vor der Kompression -->
//...
 
SOAPMessage in Interceptor (printed by soapMessage.writeTo):
<xplg:InputData bytes="1349"/> Die Groesse der Nutzdaten
                    vor der Kompression
 
I don't know exactly what happens in message.getContent, but I guess that there
is the problem I'm running into. Can you please help me out and tell me what I'm
doing wrong?
 
Best regards
Michael