You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Manolescu, Radu (IT)" <Ra...@MorganStanley.com> on 2008/06/13 21:10:49 UTC

Jira CXF-1538 | SAAJOutInterceptor | Message Content OutputStream null | Seeking Workaround

Is there a workaround at this time for Jira "CXF-1538"
(https://issues.apache.org/jira/browse/CXF-1538
<https://issues.apache.org/jira/browse/CXF-1538> )?
We are hitting against this bug while trying to send signed SOAP
messages over HTTPS.
 
We understand that this is an open Jira, but we would like to understand
more about what is going on, so that we can find a workaround.
Why is this interceptor in the chain? What function does it provide?
Can we remove it from the chain? Can we replace it in the chain by our
own implementation?
If we were to implement a replacement, what should that replacement do?
Use an XMLStreamWriter?
 
Our interceptor chain is the following:
 
Chain org.apache.cxf.phase.PhaseInterceptorChain@83ce25. Current flow:
  pre-logical [HolderOutInterceptor, SwAOutInterceptor,
WrapperClassOutInterceptor, SoapHeaderOutFilterInterceptor]
  post-logical [SoapActionOutInterceptor]
  prepare-send [MessageSenderInterceptor]
  pre-stream [MSXMLStreamOutInterceptor, LoggingOutInterceptor,
SoapPreProtocolOutInterceptor, AttachmentOutInterceptor]
  pre-protocol [SAAJOutInterceptor, SOAPHandlerInterceptor]
  write [SoapOutInterceptor]
  pre-marshal [LogicalHandlerOutInterceptor]
  marshal [BareOutInterceptor]
  post-protocol [WSS4JOutInterceptor]
  write-ending [SoapOutEndingInterceptor]
  pre-protocol-ending [SAAJOutEndingInterceptor]
  prepare-send-ending [MessageFlushInterceptor,
MessageSenderEndingInterceptor]

The code which presents the problem (Jira CXF-1538):
 
SAAJOutInterceptor.java
        public void handleMessage(SoapMessage message) throws Fault {
            SOAPMessage soapMessage =
message.getContent(SOAPMessage.class);
 
            if (soapMessage != null) { // IN OUR CASE, message!=null,
soapMessage!=null
                
                OutputStream os =
message.getContent(OutputStream.class); // <==== IN OUR CASE, os == null
                try {
                    setMessageContent(message, soapMessage);
                    soapMessage.writeTo(os); // <==== IN OUR CASE,
throws NullPointerException

The exception is:
[...]
Caused by: java.lang.NullPointerException
 at
com.sun.xml.messaging.saaj.soap.MessageImpl.writeTo(MessageImpl.java:122
1)
 at
org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor$SAAJOutEndingInterce
ptor.handleMessage(SAAJOutInterceptor.java:116)
 at
org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor$SAAJOutEndingInterce
ptor.handleMessage(SAAJOutInterceptor.java:103)

 
Thanks,
 
 
Radu Manolescu
Morgan Stanley | Technology
2000 Westchester Ave, 1st Floor | Purchase, NY  10577
Phone: +1 914 225-5871
Mobile: +1 203 648-6964
Radu.Manolescu@MorganStanley.com
--------------------------------------------------------

NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error.

Re: Jira CXF-1538 | SAAJOutInterceptor | Message Content OutputStream null | Seeking Workaround

Posted by Daniel Kulp <dk...@apache.org>.
I've started trying to fix this, but it's kind of opened up a big can  
of worms.   :-(

I tried to get it to use a XMLStreamWriter, but that then exposed some  
bugs in our StaxUtils that not all the text nodes/cdata/comments got  
properly written out.   Thus, I had to fix that.   I also discovered  
our W3CDOMStreamReader didn't generate all the events it needed  
either.   Had to fix that.   I then discovered some pathways that use  
the SAAJ interceptor that caused faults to not write anything out on  
the wire.   I've now fixed those issues.

I think I have everything working again.   I'm running tests now.  If  
things go well, I'll get things committed shortly.

Dan



On Jun 13, 2008, at 3:10 PM, Manolescu, Radu (IT) wrote:

> Is there a workaround at this time for Jira "CXF-1538"
> (https://issues.apache.org/jira/browse/CXF-1538
> <https://issues.apache.org/jira/browse/CXF-1538> )?
> We are hitting against this bug while trying to send signed SOAP
> messages over HTTPS.
>
> We understand that this is an open Jira, but we would like to  
> understand
> more about what is going on, so that we can find a workaround.
> Why is this interceptor in the chain? What function does it provide?
> Can we remove it from the chain? Can we replace it in the chain by our
> own implementation?
> If we were to implement a replacement, what should that replacement  
> do?
> Use an XMLStreamWriter?
>
> Our interceptor chain is the following:
>
> Chain org.apache.cxf.phase.PhaseInterceptorChain@83ce25. Current flow:
>  pre-logical [HolderOutInterceptor, SwAOutInterceptor,
> WrapperClassOutInterceptor, SoapHeaderOutFilterInterceptor]
>  post-logical [SoapActionOutInterceptor]
>  prepare-send [MessageSenderInterceptor]
>  pre-stream [MSXMLStreamOutInterceptor, LoggingOutInterceptor,
> SoapPreProtocolOutInterceptor, AttachmentOutInterceptor]
>  pre-protocol [SAAJOutInterceptor, SOAPHandlerInterceptor]
>  write [SoapOutInterceptor]
>  pre-marshal [LogicalHandlerOutInterceptor]
>  marshal [BareOutInterceptor]
>  post-protocol [WSS4JOutInterceptor]
>  write-ending [SoapOutEndingInterceptor]
>  pre-protocol-ending [SAAJOutEndingInterceptor]
>  prepare-send-ending [MessageFlushInterceptor,
> MessageSenderEndingInterceptor]
>
> The code which presents the problem (Jira CXF-1538):
>
> SAAJOutInterceptor.java
>        public void handleMessage(SoapMessage message) throws Fault {
>            SOAPMessage soapMessage =
> message.getContent(SOAPMessage.class);
>
>            if (soapMessage != null) { // IN OUR CASE, message!=null,
> soapMessage!=null
>
>                OutputStream os =
> message.getContent(OutputStream.class); // <==== IN OUR CASE, os ==  
> null
>                try {
>                    setMessageContent(message, soapMessage);
>                    soapMessage.writeTo(os); // <==== IN OUR CASE,
> throws NullPointerException
>
> The exception is:
> [...]
> Caused by: java.lang.NullPointerException
> at
> com.sun.xml.messaging.saaj.soap.MessageImpl.writeTo(MessageImpl.java: 
> 122
> 1)
> at
> org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor 
> $SAAJOutEndingInterce
> ptor.handleMessage(SAAJOutInterceptor.java:116)
> at
> org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor 
> $SAAJOutEndingInterce
> ptor.handleMessage(SAAJOutInterceptor.java:103)
>
>
> Thanks,
>
>
> Radu Manolescu
> Morgan Stanley | Technology
> 2000 Westchester Ave, 1st Floor | Purchase, NY  10577
> Phone: +1 914 225-5871
> Mobile: +1 203 648-6964
> Radu.Manolescu@MorganStanley.com
> --------------------------------------------------------
>
> NOTICE: If received in error, please destroy and notify sender.  
> Sender does not intend to waive confidentiality or privilege. Use of  
> this email is prohibited when received in error.

---
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog