Hi, 

I've come across an issue when trying to make SOAPHandlerInterceptor able to 
read SOAPMessage in the outbound direction.  Basically the problem is that our 
current outbound interceptor chain is not a flat chain, it looks like below:

WrapperClassOutInterceptor
LogicalHandlerInterceptor
MessageSenderInterceptor
    StaxOutInterceptor
    SOAPHandlerInterceptor
    SoapOutInterceptor
        WrappedOutInterceptor
        BareOutInterceptor
       
In this chain, SoapOutInterceptor makes a call to WrappedOutInterceptor and 
BareOutInterceptor, and when all following interceptors finish, the control 
returns back to SoapOutInterceptor. This is wrong, because all interceptors 
followed by SoapOutInterceptor are called inside SoapOutInterceptor. The 
fundamental reason why we doing this is because stax. We need to write the end 
element of soap envelop in  SoapOutInterceptor when BareOutInterceptor finishes 
writing soap body (SoapOutInterceptor.handleMessage(), line 91). 

I have been thinking about this problem, unfortunately can not figure out good 
fix. Less ideal fixes I can think about are:

1. Write an advanced chain. This chain is possible to configure a sub chain for 
each main node on the chain. 

2. Do sth with Stax. I m checking if we can do anything by replacing 
XMLStreamWriter with XMLEventWriter. Or at lease, we can hope stax can provide 
some kind of callback support for writing.

3. Merge SoapOutInterceptor/WrappedOutInterceptor/BareOutInterceptor to one 
interceptor. This makes sense as essentially they are doing one job - writing  
soap message. This can be done by either making 
WrappedOutInterceptor/BareOutInterceptor a util style class or explicitly 
instantiate those interceptors inside SoapOutInterceptor. 

Actually I think this is a general problem when we moved to stax. In the short 
term, probably 3 is the easiest way to fix the problem. But please do speck out 
if you can have any better ideas. Thanks.

Cheers,
Jervis
 

Reply via email to