You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Christian Vest Hansen <ka...@gmail.com> on 2007/11/23 10:55:59 UTC

Throwing faults from within an Interceptor

I have a WSDL that defines MyFault and all of my operations can
potentially throw this fault. This fault has some custom elements and
stuff, so it is not an ordinary SoapFault, and it got its own
Exception class when I generated my Java code.

When I throw this fault from within an operation in my WebServiceImpl
class, all of the custom cruft I put in this fault gets marshalled
correctly.

However, I also have an Interceptor (that operates in the
Phase.PRE_PROTOCOL phase) that want to throw faults as well, and
preferably faults defined in my WSDL. So in the Interceptors
handleMessage() I do something like this:

throw new Fault(new MyFault("Bad stuff"));

When I do this, I only get an ordinary soap fault with a "Bad stuff"
fault string, but all of the things that are custom to the MyFault
dosn't get marshalled properly.

So, is there any way that I can remedy this? Can I make an interceptor
throw a properly marshalled custom soap fault?

CXF version 2.0.3.

-- 
Venlig hilsen / Kind regards,
Christian Vest Hansen.

Re: Throwing faults from within an Interceptor

Posted by Christian Vest Hansen <ka...@gmail.com>.
Alright, I see what's going on now. My interceptor throws exceptions
based entierly on the contents of some soap headers, but hopefully the
performance of failing calls wont be as critical as successful
operations, so it shouldn't matter if I change the phase that my
interceptor operates on.

(two minutes later)

Excellent! Changing the phase to unmarshal and adding the RPC
interceptor to the list of 'after' did the trick.

Thanks for the help :)


2007/11/27, Liu, Jervis <jl...@iona.com>:
> Ok, I saw the problem. The BindingOperationInfo is not available yet when your SSOInterceptor got invoked. See the Interceptor chain below:
>
> >   receive [AttachmentInInterceptor]
> >   post-stream [StaxInInterceptor]
> >   read [ReadHeadersInterceptor, SoapActionInInterceptor]
> >   pre-protocol [MustUnderstandInterceptor, SOAPHandlerInterceptor,
> > LogicalHandlerInInterceptor, SAAJInInterceptor, SSOInterceptor]
> >   unmarshal [URIMappingInterceptor, RPCInInterceptor,
> > SoapHeaderInterceptor]
> >   post-logical [WrapperClassInInterceptor]
> >   pre-invoke [SwAInInterceptor, HolderInInterceptor]
> >   invoke [ServiceInvokerInterceptor]
> >   post-invoke [OutgoingChainInterceptor]
>
> The BindingOperationInfo won't be available until RPCInInterceptor (or BareInInterceptor in case of doc-lit) has the operation name parsed from the incoming request. Try to move your SSOInterceptor to somewhere after RPCInInterceptor, though I am not sure if this is the most efficient way to do. Based on how you detect OperationNotAllowedFault in SSOInterceptor, say, using soap header, you should be able to stop inbound chain and return to the client early than RPCInInterceptor if you are not using any information related to operation names. However the problem is that normally checked exception is associated with an operation, to unmarshall checked exception properly you do need to know the operation being invoked , i.e., the BindingOperationInfo. If the performance is really a concern, you can do some fancy stuff like write your own fault interceptor that can unmarshall custom exceptions without knowing operation name.
>
> Cheers,
> Jervis
>
> > -----Original Message-----
> > From: Christian Vest Hansen [mailto:karmazilla@gmail.com]
> > Sent: 2007年11月27日 16:24
> > To: cxf-user@incubator.apache.org
> > Subject: Re: Throwing faults from within an Interceptor
> >
> > Following is a log-snip at level FINE. The SSOInterceptor is my
> > fault-trowing interceptor that throws an OperationNotAllowedFault
> > wrapped in a CXF Fault object.
> >
> > I notice now that the WebFaultOutInterceptor generates an NPE at line
> > 111 in its handleMessage():
> > http://fisheye6.cenqua.com/browse/celtixfire/tags/cxf-2.0.3-incubator/rt/fr
> > ontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFault
> > OutInterceptor.java?r=583877#l111
> >
> > It looks to me that there's no BindingOperationInfo in the Exchange...
> > What ever that means.
> >
> > Log output:
> > =============================================================
> > 09:11:54,287 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.transport.servlet.ServletController invokeDestination
> > FINE: Service http request on thread: Thread[http-127.0.0.1-8080-1,5,jboss]
> > 09:11:54,349 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.transport.http.AbstractHTTPDestination setHeaders
> > FINE: Request Headers: {content-length=[838], host=[localhost:8080],
> > user-agent=[Jakarta Commons-HttpClient/3.0.1],
> > content-type=[text/xml;charset=UTF-8],
> > soapaction=["http://ws.unwire.dk/ldap/Administation/v1/GetAllCustomers"]
> > }
> > 09:11:54,368 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain add
> > FINE: Adding interceptor
> > org.apache.cxf.jaxws.handler.logical.LogicalHandlerInInterceptor@30adcb
> > to phase pre-protocol
> > 09:11:54,369 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain add
> > FINE: Adding interceptor
> > org.apache.cxf.jaxws.interceptors.WrapperClassInInterceptor@e224fe to
> > phase post-logical
> > 09:11:54,369 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain add
> > FINE: Adding interceptor
> > org.apache.cxf.jaxws.interceptors.HolderInInterceptor@eacdcc to phase
> > pre-invoke
> > 09:11:54,369 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain add
> > FINE: Adding interceptor
> > org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor@6d1337 to
> > phase pre-protocol
> > 09:11:54,369 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain add
> > FINE: Adding interceptor
> > org.apache.cxf.jaxws.interceptors.SwAInInterceptor@899be to phase
> > pre-invoke
> > 09:11:54,369 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain add
> > FINE: Adding interceptor dk.unwire.ws.sso.cxf.SSOInterceptor@a594c2 to
> > phase pre-protocol
> > 09:11:54,370 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain add
> > FINE: Adding interceptor
> > org.apache.cxf.binding.soap.saaj.SAAJInInterceptor@c96812 to phase
> > pre-protocol
> > 09:11:54,370 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain add
> > FINE: Adding interceptor
> > org.apache.cxf.interceptor.AttachmentInInterceptor@cf7ac3 to phase
> > receive
> > 09:11:54,370 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain add
> > FINE: Adding interceptor
> > org.apache.cxf.interceptor.StaxInInterceptor@849b2f to phase
> > post-stream
> > 09:11:54,370 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain add
> > FINE: Adding interceptor
> > org.apache.cxf.binding.soap.interceptor.SoapActionInInterceptor@e86879
> > to phase read
> > 09:11:54,370 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain add
> > FINE: Adding interceptor
> > org.apache.cxf.binding.soap.interceptor.RPCInInterceptor@2305d7 to
> > phase unmarshal
> > 09:11:54,371 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain add
> > FINE: Adding interceptor
> > org.apache.cxf.binding.soap.interceptor.SoapHeaderInterceptor@54838f
> > to phase unmarshal
> > 09:11:54,371 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain add
> > FINE: Adding interceptor
> > org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor@8936ff
> > to phase read
> > 09:11:54,371 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain add
> > FINE: Adding interceptor
> > org.apache.cxf.binding.soap.interceptor.MustUnderstandInterceptor@79a8
> > da
> > to phase pre-protocol
> > 09:11:54,371 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain add
> > FINE: Adding interceptor
> > org.apache.cxf.interceptor.URIMappingInterceptor@3cb8df to phase
> > unmarshal
> > 09:11:54,371 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain add
> > FINE: Adding interceptor
> > org.apache.cxf.interceptor.ServiceInvokerInterceptor@8d749a to phase
> > invoke
> > 09:11:54,372 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain add
> > FINE: Adding interceptor
> > org.apache.cxf.interceptor.OutgoingChainInterceptor@e25e8c to phase
> > post-invoke
> > 09:11:54,374 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain outputChainToLog
> > FINE: Chain org.apache.cxf.phase.PhaseInterceptorChain@ba30c6 was
> > created. Current flow:
> >   receive [AttachmentInInterceptor]
> >   post-stream [StaxInInterceptor]
> >   read [ReadHeadersInterceptor, SoapActionInInterceptor]
> >   pre-protocol [MustUnderstandInterceptor, SOAPHandlerInterceptor,
> > LogicalHandlerInInterceptor, SAAJInInterceptor, SSOInterceptor]
> >   unmarshal [URIMappingInterceptor, RPCInInterceptor,
> > SoapHeaderInterceptor]
> >   post-logical [WrapperClassInInterceptor]
> >   pre-invoke [SwAInInterceptor, HolderInInterceptor]
> >   invoke [ServiceInvokerInterceptor]
> >   post-invoke [OutgoingChainInterceptor]
> > 09:11:54,374 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> > FINE: Invoking handleMessage on interceptor
> > org.apache.cxf.interceptor.AttachmentInInterceptor@cf7ac3
> > 09:11:54,374 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> > FINE: Invoking handleMessage on interceptor
> > org.apache.cxf.interceptor.StaxInInterceptor@849b2f
> > 09:11:54,513 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> > FINE: Invoking handleMessage on interceptor
> > org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor@8936ff
> > 09:11:54,521 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> > FINE: Invoking handleMessage on interceptor
> > org.apache.cxf.binding.soap.interceptor.SoapActionInInterceptor@e86879
> > 09:11:54,522 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> > FINE: Invoking handleMessage on interceptor
> > org.apache.cxf.binding.soap.interceptor.MustUnderstandInterceptor@79a8
> > da
> > 09:11:54,524 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> > FINE: Invoking handleMessage on interceptor
> > org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor@6d1337
> > 09:11:54,530 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.jaxws.handler.HandlerChainInvoker <init>
> > FINE: invoker for chain size: 0
> > 09:11:54,530 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> > FINE: Invoking handleMessage on interceptor
> > org.apache.cxf.jaxws.handler.logical.LogicalHandlerInInterceptor@30adcb
> > 09:11:54,530 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> > FINE: Invoking handleMessage on interceptor
> > org.apache.cxf.binding.soap.saaj.SAAJInInterceptor@c96812
> > 09:11:54,665 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> > FINE: Invoking handleMessage on interceptor
> > dk.unwire.ws.sso.cxf.SSOInterceptor@a594c2
> > 09:11:54,667 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> > INFO: Interceptor has thrown exception, unwinding now
> > org.apache.cxf.interceptor.Fault: Annonymous access denied.
> >       at
> > dk.unwire.ws.sso.cxf.SSOInterceptor.buildFault(SSOInterceptor.java:198)
> >       at
> > dk.unwire.ws.sso.cxf.SSOInterceptor.authorizeMessage(SSOInterceptor.java:
> > 96)
> >       at
> > dk.unwire.ws.sso.cxf.SSOInterceptor.handleMessage(SSOInterceptor.java:60)
> >       at
> > dk.unwire.ws.sso.cxf.SSOInterceptor.handleMessage(SSOInterceptor.java:1)
> >       at
> > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
> > hain.java:207)
> >       at
> > org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiation
> > Observer.java:73)
> >       at
> > org.apache.cxf.transport.servlet.ServletDestination.doMessage(ServletDesti
> > nation.java:79)
> >       at
> > org.apache.cxf.transport.servlet.ServletController.invokeDestination(Servlet
> > Controller.java:256)
> >       at
> > org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.ja
> > va:160)
> >       at
> > org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServl
> > et.java:170)
> >       at
> > org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServ
> > let.java:148)
> >       at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
> >       at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> >       at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> > FilterChain.java:290)
> >       at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> > ain.java:206)
> >       at
> > org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.jav
> > a:96)
> >       at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> > FilterChain.java:235)
> >       at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> > ain.java:206)
> >       at
> > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVa
> > lve.java:230)
> >       at
> > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
> > e.java:175)
> >       at
> > org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAsso
> > ciationValve.java:179)
> >       at
> > org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.ja
> > va:84)
> >       at
> > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
> > :128)
> >       at
> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:1
> > 04)
> >       at
> > org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedCo
> > nnectionValve.java:156)
> >       at
> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.j
> > ava:109)
> >       at
> > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:2
> > 41)
> >       at
> > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:84
> > 4)
> >       at
> > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
> > ss(Http11Protocol.java:580)
> >       at
> > org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
> >       at java.lang.Thread.run(Thread.java:613)
> > Caused by: dk.unwire.ws.ldap.administration.v1.OperationNotAllowedFault:
> > Annonymous access denied.
> > 09:11:54,668 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain unwind
> > FINE: Invoking handleFault on interceptor
> > dk.unwire.ws.sso.cxf.SSOInterceptor@a594c2
> > 09:11:54,668 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain unwind
> > FINE: Invoking handleFault on interceptor
> > org.apache.cxf.binding.soap.saaj.SAAJInInterceptor@c96812
> > 09:11:54,668 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain unwind
> > FINE: Invoking handleFault on interceptor
> > org.apache.cxf.jaxws.handler.logical.LogicalHandlerInInterceptor@30adcb
> > 09:11:54,668 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain unwind
> > FINE: Invoking handleFault on interceptor
> > org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor@6d1337
> > 09:11:54,669 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain unwind
> > FINE: Invoking handleFault on interceptor
> > org.apache.cxf.binding.soap.interceptor.MustUnderstandInterceptor@79a8
> > da
> > 09:11:54,669 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain unwind
> > FINE: Invoking handleFault on interceptor
> > org.apache.cxf.binding.soap.interceptor.SoapActionInInterceptor@e86879
> > 09:11:54,669 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain unwind
> > FINE: Invoking handleFault on interceptor
> > org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor@8936ff
> > 09:11:54,669 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain unwind
> > FINE: Invoking handleFault on interceptor
> > org.apache.cxf.interceptor.StaxInInterceptor@849b2f
> > 09:11:54,669 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain unwind
> > FINE: Invoking handleFault on interceptor
> > org.apache.cxf.interceptor.AttachmentInInterceptor@cf7ac3
> > 09:11:54,670 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain add
> > FINE: Adding interceptor
> > org.apache.cxf.interceptor.MessageSenderInterceptor@91eb59 to phase
> > prepare-send
> > 09:11:54,670 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain add
> > FINE: Adding interceptor
> > org.apache.cxf.jaxws.handler.logical.LogicalHandlerFaultOutInterceptor@f2
> > 24f7
> > to phase pre-marshal
> > 09:11:54,670 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain add
> > FINE: Adding interceptor
> > org.apache.cxf.jaxws.handler.soap.SOAPHandlerFaultOutInterceptor@58fa9
> > 1
> > to phase pre-protocol
> > 09:11:54,671 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain add
> > FINE: Adding interceptor
> > org.apache.cxf.interceptor.StaxOutInterceptor@aa767e to phase
> > pre-stream
> > 09:11:54,671 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain add
> > FINE: Adding interceptor
> > org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor@49707d to
> > phase write
> > 09:11:54,671 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain add
> > FINE: Adding interceptor
> > org.apache.cxf.binding.soap.interceptor.Soap11FaultOutInterceptor@785ec
> > d
> > to phase marshal
> > 09:11:54,671 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain add
> > FINE: Adding interceptor
> > org.apache.cxf.jaxws.interceptors.WebFaultOutInterceptor@981635 to
> > phase pre-protocol
> > 09:11:54,671 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain outputChainToLog
> > FINE: Chain org.apache.cxf.phase.PhaseInterceptorChain@da3281 was
> > created. Current flow:
> >   prepare-send [MessageSenderInterceptor]
> >   pre-stream [StaxOutInterceptor]
> >   pre-protocol [SOAPHandlerFaultOutInterceptor, WebFaultOutInterceptor]
> >   write [SoapOutInterceptor]
> >   pre-marshal [LogicalHandlerFaultOutInterceptor]
> >   marshal [Soap11FaultOutInterceptor]
> > 09:11:54,672 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> > FINE: Invoking handleMessage on interceptor
> > org.apache.cxf.interceptor.MessageSenderInterceptor@91eb59
> > 09:11:54,677 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain add
> > FINE: Adding interceptor
> > org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndin
> > gInterceptor@123c4a
> > to phase prepare-send-ending
> > 09:11:54,677 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain outputChainToLog
> > FINE: Chain org.apache.cxf.phase.PhaseInterceptorChain@da3281 was
> > modified. Current flow:
> >   prepare-send [MessageSenderInterceptor]
> >   pre-stream [StaxOutInterceptor]
> >   pre-protocol [SOAPHandlerFaultOutInterceptor, WebFaultOutInterceptor]
> >   write [SoapOutInterceptor]
> >   pre-marshal [LogicalHandlerFaultOutInterceptor]
> >   marshal [Soap11FaultOutInterceptor]
> >   prepare-send-ending [MessageSenderEndingInterceptor]
> > 09:11:54,677 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> > FINE: Invoking handleMessage on interceptor
> > org.apache.cxf.interceptor.StaxOutInterceptor@aa767e
> > 09:11:54,685 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain add
> > FINE: Adding interceptor
> > org.apache.cxf.interceptor.StaxOutInterceptor$StaxOutEndingInterceptor@
> > 1b48a
> > to phase pre-stream-ending
> > 09:11:54,686 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain outputChainToLog
> > FINE: Chain org.apache.cxf.phase.PhaseInterceptorChain@da3281 was
> > modified. Current flow:
> >   prepare-send [MessageSenderInterceptor]
> >   pre-stream [StaxOutInterceptor]
> >   pre-protocol [SOAPHandlerFaultOutInterceptor, WebFaultOutInterceptor]
> >   write [SoapOutInterceptor]
> >   pre-marshal [LogicalHandlerFaultOutInterceptor]
> >   marshal [Soap11FaultOutInterceptor]
> >   pre-stream-ending [StaxOutEndingInterceptor]
> >   prepare-send-ending [MessageSenderEndingInterceptor]
> > 09:11:54,686 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> > FINE: Invoking handleMessage on interceptor
> > org.apache.cxf.jaxws.handler.soap.SOAPHandlerFaultOutInterceptor@58fa9
> > 1
> > 09:11:54,686 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> > FINE: Invoking handleMessage on interceptor
> > org.apache.cxf.jaxws.interceptors.WebFaultOutInterceptor@981635
> > 09:11:54,691 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.jaxws.interceptors.WebFaultOutInterceptor handleMessage
> > WARNING: EXCEPTION_WHILE_WRITING_FAULT
> > java.lang.NullPointerException
> >       at
> > org.apache.cxf.jaxws.interceptors.WebFaultOutInterceptor.handleMessage(
> > WebFaultOutInterceptor.java:111)
> >       at
> > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
> > hain.java:207)
> >       at
> > org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(
> > AbstractFaultChainInitiatorObserver.java:90)
> >       at
> > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
> > hain.java:224)
> >       at
> > org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiation
> > Observer.java:73)
> >       at
> > org.apache.cxf.transport.servlet.ServletDestination.doMessage(ServletDesti
> > nation.java:79)
> >       at
> > org.apache.cxf.transport.servlet.ServletController.invokeDestination(Servlet
> > Controller.java:256)
> >       at
> > org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.ja
> > va:160)
> >       at
> > org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServl
> > et.java:170)
> >       at
> > org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServ
> > let.java:148)
> >       at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
> >       at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> >       at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> > FilterChain.java:290)
> >       at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> > ain.java:206)
> >       at
> > org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.jav
> > a:96)
> >       at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> > FilterChain.java:235)
> >       at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> > ain.java:206)
> >       at
> > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVa
> > lve.java:230)
> >       at
> > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
> > e.java:175)
> >       at
> > org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAsso
> > ciationValve.java:179)
> >       at
> > org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.ja
> > va:84)
> >       at
> > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
> > :128)
> >       at
> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:1
> > 04)
> >       at
> > org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedCo
> > nnectionValve.java:156)
> >       at
> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.j
> > ava:109)
> >       at
> > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:2
> > 41)
> >       at
> > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:84
> > 4)
> >       at
> > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
> > ss(Http11Protocol.java:580)
> >       at
> > org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
> >       at java.lang.Thread.run(Thread.java:613)
> > 09:11:54,691 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> > FINE: Invoking handleMessage on interceptor
> > org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor@49707d
> > 09:11:54,695 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain add
> > FINE: Adding interceptor
> > org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEndin
> > gInterceptor@c54858
> > to phase write-ending
> > 09:11:54,695 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain outputChainToLog
> > FINE: Chain org.apache.cxf.phase.PhaseInterceptorChain@da3281 was
> > modified. Current flow:
> >   prepare-send [MessageSenderInterceptor]
> >   pre-stream [StaxOutInterceptor]
> >   pre-protocol [SOAPHandlerFaultOutInterceptor, WebFaultOutInterceptor]
> >   write [SoapOutInterceptor]
> >   pre-marshal [LogicalHandlerFaultOutInterceptor]
> >   marshal [Soap11FaultOutInterceptor]
> >   write-ending [SoapOutEndingInterceptor]
> >   pre-stream-ending [StaxOutEndingInterceptor]
> >   prepare-send-ending [MessageSenderEndingInterceptor]
> > 09:11:54,695 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> > FINE: Invoking handleMessage on interceptor
> > org.apache.cxf.jaxws.handler.logical.LogicalHandlerFaultOutInterceptor@f2
> > 24f7
> > 09:11:54,695 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> > FINE: Invoking handleMessage on interceptor
> > org.apache.cxf.binding.soap.interceptor.Soap11FaultOutInterceptor@785ec
> > d
> > 09:11:54,697 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> > FINE: Invoking handleMessage on interceptor
> > org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEndin
> > gInterceptor@c54858
> > 09:11:54,697 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> > FINE: Invoking handleMessage on interceptor
> > org.apache.cxf.interceptor.StaxOutInterceptor$StaxOutEndingInterceptor@
> > 1b48a
> > 09:11:54,697 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> > FINE: Invoking handleMessage on interceptor
> > org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndin
> > gInterceptor@123c4a
> > 09:11:54,704 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> > org.apache.cxf.transport.servlet.ServletDestination doMessage
> > FINE: Finished servicing http request on thread:
> > Thread[http-127.0.0.1-8080-1,5,jboss]
> >
> >
> >
> >
> > 2007/11/27, Liu, Jervis <jl...@iona.com>:
> > >
> > >
> > > > -----Original Message-----
> > > > From: Christian Vest Hansen [mailto:karmazilla@gmail.com]
> > > > Sent: 2007年11月26日 18:36
> > > > To: cxf-user@incubator.apache.org
> > > > Subject: Re: Throwing faults from within an Interceptor
> > > >
> > > > Hello Jervis.
> > > >
> > > > > Make sure the exception thrown from your interceptor is declared as
> > an
> > > > exception on the operation being invoked
> > > >
> > > > It is. It is declared to be thrown in the WSDL and on my implementation
> > > > methods.
> > > >
> > > > > was the MyFault class generated by wsdltojava? does it have the
> > WebFault
> > > > annotation?
> > > >
> > > > Yes and yes.
> > > >
> > > > > Take a look into WebFaultOutInterceptor. handleMessage(), the code
> > might
> > > > tell you why WebFaultOutInterceptor did not recognize your exception as
> > a
> > > > checked exception.
> > > >
> > > > Looks like it should work, but I can't help thinking that it might be
> > > > because my interceptor runs PRE_PROTOCOL. Are we certain that faults
> > > > always go through this WebFaultOutInterceptor?
> > > >
> > >
> > > It should, if you are using JAX-WS frontend. Where your interceptor sits
> > does not really matter, as when the exception is thrown from the outbound
> > interceptor chain, CXF will start a new interceptor chain to deal with
> > exceptions (fault out interceptor chain). Can you set your log level to FINE to
> > see what interceptors you have in your fault out chain.
> > >
> > > Thanks,
> > > Jervis
> > >
> > > >
> > > > 2007/11/26, Liu, Jervis <jl...@iona.com>:
> > > > > Hi, it is possible to throw a checked Exception from CXF interceptors.
> > Make
> > > > sure the exception thrown from your interceptor is declared as an
> > exception
> > > > on the operation being invoked, otherwise this exception will not be
> > > > recognized as a checked Exception. Also was the MyFault class generated
> > by
> > > > wsdltojava? does it have the WebFault annotation? The checked
> > exception is
> > > > unmarshalled by WebFaultOutInterceptor and its super class
> > > > FaultOutInterceptor. If the exception is not recognized as checked
> > exception
> > > > by WebFaultOutInterceptor, the exception will be handled by the default
> > > > protocol binding fault interceptors such as Soap11FaultOutInterceptor
> > and
> > > > Soap12FaultOutInterceptor. Take a look into WebFaultOutInterceptor.
> > > > handleMessage(), the code might tell you why WebFaultOutInterceptor
> > did
> > > > not recognize your exception as a checked exception.
> > > > >
> > > > > Let me know if you have any further questions,
> > > > >
> > > > > Jervis
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Christian Vest Hansen [mailto:karmazilla@gmail.com]
> > > > > > Sent: 2007年11月23日 17:56
> > > > > > To: cxf-user@incubator.apache.org
> > > > > > Subject: Throwing faults from within an Interceptor
> > > > > >
> > > > > > I have a WSDL that defines MyFault and all of my operations can
> > > > > > potentially throw this fault. This fault has some custom elements and
> > > > > > stuff, so it is not an ordinary SoapFault, and it got its own
> > > > > > Exception class when I generated my Java code.
> > > > > >
> > > > > > When I throw this fault from within an operation in my
> > WebServiceImpl
> > > > > > class, all of the custom cruft I put in this fault gets marshalled
> > > > > > correctly.
> > > > > >
> > > > > > However, I also have an Interceptor (that operates in the
> > > > > > Phase.PRE_PROTOCOL phase) that want to throw faults as well, and
> > > > > > preferably faults defined in my WSDL. So in the Interceptors
> > > > > > handleMessage() I do something like this:
> > > > > >
> > > > > > throw new Fault(new MyFault("Bad stuff"));
> > > > > >
> > > > > > When I do this, I only get an ordinary soap fault with a "Bad stuff"
> > > > > > fault string, but all of the things that are custom to the MyFault
> > > > > > dosn't get marshalled properly.
> > > > > >
> > > > > > So, is there any way that I can remedy this? Can I make an interceptor
> > > > > > throw a properly marshalled custom soap fault?
> > > > > >
> > > > > > CXF version 2.0.3.
> > > > > >
> > > > > > --
> > > > > > Venlig hilsen / Kind regards,
> > > > > > Christian Vest Hansen.
> > > > >
> > > > > ----------------------------
> > > > > IONA Technologies PLC (registered in Ireland)
> > > > > Registered Number: 171387
> > > > > Registered Address: The IONA Building, Shelbourne Road, Dublin 4,
> > Ireland
> > > > >
> > > >
> > > >
> > > > --
> > > > Venlig hilsen / Kind regards,
> > > > Christian Vest Hansen.
> > >
> > > ----------------------------
> > > IONA Technologies PLC (registered in Ireland)
> > > Registered Number: 171387
> > > Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
> > >
> >
> >
> > --
> > Venlig hilsen / Kind regards,
> > Christian Vest Hansen.
>
> ----------------------------
> IONA Technologies PLC (registered in Ireland)
> Registered Number: 171387
> Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
>


-- 
Venlig hilsen / Kind regards,
Christian Vest Hansen.

RE: Throwing faults from within an Interceptor

Posted by "Liu, Jervis" <jl...@iona.com>.
Ok, I saw the problem. The BindingOperationInfo is not available yet when your SSOInterceptor got invoked. See the Interceptor chain below:

>   receive [AttachmentInInterceptor]
>   post-stream [StaxInInterceptor]
>   read [ReadHeadersInterceptor, SoapActionInInterceptor]
>   pre-protocol [MustUnderstandInterceptor, SOAPHandlerInterceptor,
> LogicalHandlerInInterceptor, SAAJInInterceptor, SSOInterceptor]
>   unmarshal [URIMappingInterceptor, RPCInInterceptor,
> SoapHeaderInterceptor]
>   post-logical [WrapperClassInInterceptor]
>   pre-invoke [SwAInInterceptor, HolderInInterceptor]
>   invoke [ServiceInvokerInterceptor]
>   post-invoke [OutgoingChainInterceptor]

The BindingOperationInfo won't be available until RPCInInterceptor (or BareInInterceptor in case of doc-lit) has the operation name parsed from the incoming request. Try to move your SSOInterceptor to somewhere after RPCInInterceptor, though I am not sure if this is the most efficient way to do. Based on how you detect OperationNotAllowedFault in SSOInterceptor, say, using soap header, you should be able to stop inbound chain and return to the client early than RPCInInterceptor if you are not using any information related to operation names. However the problem is that normally checked exception is associated with an operation, to unmarshall checked exception properly you do need to know the operation being invoked , i.e., the BindingOperationInfo. If the performance is really a concern, you can do some fancy stuff like write your own fault interceptor that can unmarshall custom exceptions without knowing operation name.

Cheers,
Jervis 

> -----Original Message-----
> From: Christian Vest Hansen [mailto:karmazilla@gmail.com]
> Sent: 2007年11月27日 16:24
> To: cxf-user@incubator.apache.org
> Subject: Re: Throwing faults from within an Interceptor
> 
> Following is a log-snip at level FINE. The SSOInterceptor is my
> fault-trowing interceptor that throws an OperationNotAllowedFault
> wrapped in a CXF Fault object.
> 
> I notice now that the WebFaultOutInterceptor generates an NPE at line
> 111 in its handleMessage():
> http://fisheye6.cenqua.com/browse/celtixfire/tags/cxf-2.0.3-incubator/rt/fr
> ontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFault
> OutInterceptor.java?r=583877#l111
> 
> It looks to me that there's no BindingOperationInfo in the Exchange...
> What ever that means.
> 
> Log output:
> =============================================================
> 09:11:54,287 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.transport.servlet.ServletController invokeDestination
> FINE: Service http request on thread: Thread[http-127.0.0.1-8080-1,5,jboss]
> 09:11:54,349 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.transport.http.AbstractHTTPDestination setHeaders
> FINE: Request Headers: {content-length=[838], host=[localhost:8080],
> user-agent=[Jakarta Commons-HttpClient/3.0.1],
> content-type=[text/xml;charset=UTF-8],
> soapaction=["http://ws.unwire.dk/ldap/Administation/v1/GetAllCustomers"]
> }
> 09:11:54,368 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain add
> FINE: Adding interceptor
> org.apache.cxf.jaxws.handler.logical.LogicalHandlerInInterceptor@30adcb
> to phase pre-protocol
> 09:11:54,369 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain add
> FINE: Adding interceptor
> org.apache.cxf.jaxws.interceptors.WrapperClassInInterceptor@e224fe to
> phase post-logical
> 09:11:54,369 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain add
> FINE: Adding interceptor
> org.apache.cxf.jaxws.interceptors.HolderInInterceptor@eacdcc to phase
> pre-invoke
> 09:11:54,369 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain add
> FINE: Adding interceptor
> org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor@6d1337 to
> phase pre-protocol
> 09:11:54,369 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain add
> FINE: Adding interceptor
> org.apache.cxf.jaxws.interceptors.SwAInInterceptor@899be to phase
> pre-invoke
> 09:11:54,369 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain add
> FINE: Adding interceptor dk.unwire.ws.sso.cxf.SSOInterceptor@a594c2 to
> phase pre-protocol
> 09:11:54,370 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain add
> FINE: Adding interceptor
> org.apache.cxf.binding.soap.saaj.SAAJInInterceptor@c96812 to phase
> pre-protocol
> 09:11:54,370 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain add
> FINE: Adding interceptor
> org.apache.cxf.interceptor.AttachmentInInterceptor@cf7ac3 to phase
> receive
> 09:11:54,370 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain add
> FINE: Adding interceptor
> org.apache.cxf.interceptor.StaxInInterceptor@849b2f to phase
> post-stream
> 09:11:54,370 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain add
> FINE: Adding interceptor
> org.apache.cxf.binding.soap.interceptor.SoapActionInInterceptor@e86879
> to phase read
> 09:11:54,370 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain add
> FINE: Adding interceptor
> org.apache.cxf.binding.soap.interceptor.RPCInInterceptor@2305d7 to
> phase unmarshal
> 09:11:54,371 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain add
> FINE: Adding interceptor
> org.apache.cxf.binding.soap.interceptor.SoapHeaderInterceptor@54838f
> to phase unmarshal
> 09:11:54,371 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain add
> FINE: Adding interceptor
> org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor@8936ff
> to phase read
> 09:11:54,371 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain add
> FINE: Adding interceptor
> org.apache.cxf.binding.soap.interceptor.MustUnderstandInterceptor@79a8
> da
> to phase pre-protocol
> 09:11:54,371 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain add
> FINE: Adding interceptor
> org.apache.cxf.interceptor.URIMappingInterceptor@3cb8df to phase
> unmarshal
> 09:11:54,371 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain add
> FINE: Adding interceptor
> org.apache.cxf.interceptor.ServiceInvokerInterceptor@8d749a to phase
> invoke
> 09:11:54,372 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain add
> FINE: Adding interceptor
> org.apache.cxf.interceptor.OutgoingChainInterceptor@e25e8c to phase
> post-invoke
> 09:11:54,374 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain outputChainToLog
> FINE: Chain org.apache.cxf.phase.PhaseInterceptorChain@ba30c6 was
> created. Current flow:
>   receive [AttachmentInInterceptor]
>   post-stream [StaxInInterceptor]
>   read [ReadHeadersInterceptor, SoapActionInInterceptor]
>   pre-protocol [MustUnderstandInterceptor, SOAPHandlerInterceptor,
> LogicalHandlerInInterceptor, SAAJInInterceptor, SSOInterceptor]
>   unmarshal [URIMappingInterceptor, RPCInInterceptor,
> SoapHeaderInterceptor]
>   post-logical [WrapperClassInInterceptor]
>   pre-invoke [SwAInInterceptor, HolderInInterceptor]
>   invoke [ServiceInvokerInterceptor]
>   post-invoke [OutgoingChainInterceptor]
> 09:11:54,374 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> FINE: Invoking handleMessage on interceptor
> org.apache.cxf.interceptor.AttachmentInInterceptor@cf7ac3
> 09:11:54,374 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> FINE: Invoking handleMessage on interceptor
> org.apache.cxf.interceptor.StaxInInterceptor@849b2f
> 09:11:54,513 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> FINE: Invoking handleMessage on interceptor
> org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor@8936ff
> 09:11:54,521 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> FINE: Invoking handleMessage on interceptor
> org.apache.cxf.binding.soap.interceptor.SoapActionInInterceptor@e86879
> 09:11:54,522 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> FINE: Invoking handleMessage on interceptor
> org.apache.cxf.binding.soap.interceptor.MustUnderstandInterceptor@79a8
> da
> 09:11:54,524 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> FINE: Invoking handleMessage on interceptor
> org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor@6d1337
> 09:11:54,530 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.jaxws.handler.HandlerChainInvoker <init>
> FINE: invoker for chain size: 0
> 09:11:54,530 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> FINE: Invoking handleMessage on interceptor
> org.apache.cxf.jaxws.handler.logical.LogicalHandlerInInterceptor@30adcb
> 09:11:54,530 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> FINE: Invoking handleMessage on interceptor
> org.apache.cxf.binding.soap.saaj.SAAJInInterceptor@c96812
> 09:11:54,665 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> FINE: Invoking handleMessage on interceptor
> dk.unwire.ws.sso.cxf.SSOInterceptor@a594c2
> 09:11:54,667 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> INFO: Interceptor has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: Annonymous access denied.
> 	at
> dk.unwire.ws.sso.cxf.SSOInterceptor.buildFault(SSOInterceptor.java:198)
> 	at
> dk.unwire.ws.sso.cxf.SSOInterceptor.authorizeMessage(SSOInterceptor.java:
> 96)
> 	at
> dk.unwire.ws.sso.cxf.SSOInterceptor.handleMessage(SSOInterceptor.java:60)
> 	at
> dk.unwire.ws.sso.cxf.SSOInterceptor.handleMessage(SSOInterceptor.java:1)
> 	at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
> hain.java:207)
> 	at
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiation
> Observer.java:73)
> 	at
> org.apache.cxf.transport.servlet.ServletDestination.doMessage(ServletDesti
> nation.java:79)
> 	at
> org.apache.cxf.transport.servlet.ServletController.invokeDestination(Servlet
> Controller.java:256)
> 	at
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.ja
> va:160)
> 	at
> org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServl
> et.java:170)
> 	at
> org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServ
> let.java:148)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> 	at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:290)
> 	at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:206)
> 	at
> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.jav
> a:96)
> 	at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:235)
> 	at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:206)
> 	at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVa
> lve.java:230)
> 	at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
> e.java:175)
> 	at
> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAsso
> ciationValve.java:179)
> 	at
> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.ja
> va:84)
> 	at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
> :128)
> 	at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:1
> 04)
> 	at
> org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedCo
> nnectionValve.java:156)
> 	at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.j
> ava:109)
> 	at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:2
> 41)
> 	at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:84
> 4)
> 	at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
> ss(Http11Protocol.java:580)
> 	at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
> 	at java.lang.Thread.run(Thread.java:613)
> Caused by: dk.unwire.ws.ldap.administration.v1.OperationNotAllowedFault:
> Annonymous access denied.
> 09:11:54,668 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain unwind
> FINE: Invoking handleFault on interceptor
> dk.unwire.ws.sso.cxf.SSOInterceptor@a594c2
> 09:11:54,668 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain unwind
> FINE: Invoking handleFault on interceptor
> org.apache.cxf.binding.soap.saaj.SAAJInInterceptor@c96812
> 09:11:54,668 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain unwind
> FINE: Invoking handleFault on interceptor
> org.apache.cxf.jaxws.handler.logical.LogicalHandlerInInterceptor@30adcb
> 09:11:54,668 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain unwind
> FINE: Invoking handleFault on interceptor
> org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor@6d1337
> 09:11:54,669 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain unwind
> FINE: Invoking handleFault on interceptor
> org.apache.cxf.binding.soap.interceptor.MustUnderstandInterceptor@79a8
> da
> 09:11:54,669 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain unwind
> FINE: Invoking handleFault on interceptor
> org.apache.cxf.binding.soap.interceptor.SoapActionInInterceptor@e86879
> 09:11:54,669 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain unwind
> FINE: Invoking handleFault on interceptor
> org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor@8936ff
> 09:11:54,669 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain unwind
> FINE: Invoking handleFault on interceptor
> org.apache.cxf.interceptor.StaxInInterceptor@849b2f
> 09:11:54,669 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain unwind
> FINE: Invoking handleFault on interceptor
> org.apache.cxf.interceptor.AttachmentInInterceptor@cf7ac3
> 09:11:54,670 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain add
> FINE: Adding interceptor
> org.apache.cxf.interceptor.MessageSenderInterceptor@91eb59 to phase
> prepare-send
> 09:11:54,670 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain add
> FINE: Adding interceptor
> org.apache.cxf.jaxws.handler.logical.LogicalHandlerFaultOutInterceptor@f2
> 24f7
> to phase pre-marshal
> 09:11:54,670 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain add
> FINE: Adding interceptor
> org.apache.cxf.jaxws.handler.soap.SOAPHandlerFaultOutInterceptor@58fa9
> 1
> to phase pre-protocol
> 09:11:54,671 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain add
> FINE: Adding interceptor
> org.apache.cxf.interceptor.StaxOutInterceptor@aa767e to phase
> pre-stream
> 09:11:54,671 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain add
> FINE: Adding interceptor
> org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor@49707d to
> phase write
> 09:11:54,671 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain add
> FINE: Adding interceptor
> org.apache.cxf.binding.soap.interceptor.Soap11FaultOutInterceptor@785ec
> d
> to phase marshal
> 09:11:54,671 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain add
> FINE: Adding interceptor
> org.apache.cxf.jaxws.interceptors.WebFaultOutInterceptor@981635 to
> phase pre-protocol
> 09:11:54,671 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain outputChainToLog
> FINE: Chain org.apache.cxf.phase.PhaseInterceptorChain@da3281 was
> created. Current flow:
>   prepare-send [MessageSenderInterceptor]
>   pre-stream [StaxOutInterceptor]
>   pre-protocol [SOAPHandlerFaultOutInterceptor, WebFaultOutInterceptor]
>   write [SoapOutInterceptor]
>   pre-marshal [LogicalHandlerFaultOutInterceptor]
>   marshal [Soap11FaultOutInterceptor]
> 09:11:54,672 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> FINE: Invoking handleMessage on interceptor
> org.apache.cxf.interceptor.MessageSenderInterceptor@91eb59
> 09:11:54,677 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain add
> FINE: Adding interceptor
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndin
> gInterceptor@123c4a
> to phase prepare-send-ending
> 09:11:54,677 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain outputChainToLog
> FINE: Chain org.apache.cxf.phase.PhaseInterceptorChain@da3281 was
> modified. Current flow:
>   prepare-send [MessageSenderInterceptor]
>   pre-stream [StaxOutInterceptor]
>   pre-protocol [SOAPHandlerFaultOutInterceptor, WebFaultOutInterceptor]
>   write [SoapOutInterceptor]
>   pre-marshal [LogicalHandlerFaultOutInterceptor]
>   marshal [Soap11FaultOutInterceptor]
>   prepare-send-ending [MessageSenderEndingInterceptor]
> 09:11:54,677 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> FINE: Invoking handleMessage on interceptor
> org.apache.cxf.interceptor.StaxOutInterceptor@aa767e
> 09:11:54,685 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain add
> FINE: Adding interceptor
> org.apache.cxf.interceptor.StaxOutInterceptor$StaxOutEndingInterceptor@
> 1b48a
> to phase pre-stream-ending
> 09:11:54,686 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain outputChainToLog
> FINE: Chain org.apache.cxf.phase.PhaseInterceptorChain@da3281 was
> modified. Current flow:
>   prepare-send [MessageSenderInterceptor]
>   pre-stream [StaxOutInterceptor]
>   pre-protocol [SOAPHandlerFaultOutInterceptor, WebFaultOutInterceptor]
>   write [SoapOutInterceptor]
>   pre-marshal [LogicalHandlerFaultOutInterceptor]
>   marshal [Soap11FaultOutInterceptor]
>   pre-stream-ending [StaxOutEndingInterceptor]
>   prepare-send-ending [MessageSenderEndingInterceptor]
> 09:11:54,686 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> FINE: Invoking handleMessage on interceptor
> org.apache.cxf.jaxws.handler.soap.SOAPHandlerFaultOutInterceptor@58fa9
> 1
> 09:11:54,686 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> FINE: Invoking handleMessage on interceptor
> org.apache.cxf.jaxws.interceptors.WebFaultOutInterceptor@981635
> 09:11:54,691 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.jaxws.interceptors.WebFaultOutInterceptor handleMessage
> WARNING: EXCEPTION_WHILE_WRITING_FAULT
> java.lang.NullPointerException
> 	at
> org.apache.cxf.jaxws.interceptors.WebFaultOutInterceptor.handleMessage(
> WebFaultOutInterceptor.java:111)
> 	at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
> hain.java:207)
> 	at
> org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(
> AbstractFaultChainInitiatorObserver.java:90)
> 	at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
> hain.java:224)
> 	at
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiation
> Observer.java:73)
> 	at
> org.apache.cxf.transport.servlet.ServletDestination.doMessage(ServletDesti
> nation.java:79)
> 	at
> org.apache.cxf.transport.servlet.ServletController.invokeDestination(Servlet
> Controller.java:256)
> 	at
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.ja
> va:160)
> 	at
> org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServl
> et.java:170)
> 	at
> org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServ
> let.java:148)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> 	at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:290)
> 	at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:206)
> 	at
> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.jav
> a:96)
> 	at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:235)
> 	at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:206)
> 	at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVa
> lve.java:230)
> 	at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
> e.java:175)
> 	at
> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAsso
> ciationValve.java:179)
> 	at
> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.ja
> va:84)
> 	at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
> :128)
> 	at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:1
> 04)
> 	at
> org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedCo
> nnectionValve.java:156)
> 	at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.j
> ava:109)
> 	at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:2
> 41)
> 	at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:84
> 4)
> 	at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
> ss(Http11Protocol.java:580)
> 	at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
> 	at java.lang.Thread.run(Thread.java:613)
> 09:11:54,691 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> FINE: Invoking handleMessage on interceptor
> org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor@49707d
> 09:11:54,695 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain add
> FINE: Adding interceptor
> org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEndin
> gInterceptor@c54858
> to phase write-ending
> 09:11:54,695 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain outputChainToLog
> FINE: Chain org.apache.cxf.phase.PhaseInterceptorChain@da3281 was
> modified. Current flow:
>   prepare-send [MessageSenderInterceptor]
>   pre-stream [StaxOutInterceptor]
>   pre-protocol [SOAPHandlerFaultOutInterceptor, WebFaultOutInterceptor]
>   write [SoapOutInterceptor]
>   pre-marshal [LogicalHandlerFaultOutInterceptor]
>   marshal [Soap11FaultOutInterceptor]
>   write-ending [SoapOutEndingInterceptor]
>   pre-stream-ending [StaxOutEndingInterceptor]
>   prepare-send-ending [MessageSenderEndingInterceptor]
> 09:11:54,695 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> FINE: Invoking handleMessage on interceptor
> org.apache.cxf.jaxws.handler.logical.LogicalHandlerFaultOutInterceptor@f2
> 24f7
> 09:11:54,695 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> FINE: Invoking handleMessage on interceptor
> org.apache.cxf.binding.soap.interceptor.Soap11FaultOutInterceptor@785ec
> d
> 09:11:54,697 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> FINE: Invoking handleMessage on interceptor
> org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEndin
> gInterceptor@c54858
> 09:11:54,697 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> FINE: Invoking handleMessage on interceptor
> org.apache.cxf.interceptor.StaxOutInterceptor$StaxOutEndingInterceptor@
> 1b48a
> 09:11:54,697 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> FINE: Invoking handleMessage on interceptor
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndin
> gInterceptor@123c4a
> 09:11:54,704 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
> org.apache.cxf.transport.servlet.ServletDestination doMessage
> FINE: Finished servicing http request on thread:
> Thread[http-127.0.0.1-8080-1,5,jboss]
> 
> 
> 
> 
> 2007/11/27, Liu, Jervis <jl...@iona.com>:
> >
> >
> > > -----Original Message-----
> > > From: Christian Vest Hansen [mailto:karmazilla@gmail.com]
> > > Sent: 2007年11月26日 18:36
> > > To: cxf-user@incubator.apache.org
> > > Subject: Re: Throwing faults from within an Interceptor
> > >
> > > Hello Jervis.
> > >
> > > > Make sure the exception thrown from your interceptor is declared as
> an
> > > exception on the operation being invoked
> > >
> > > It is. It is declared to be thrown in the WSDL and on my implementation
> > > methods.
> > >
> > > > was the MyFault class generated by wsdltojava? does it have the
> WebFault
> > > annotation?
> > >
> > > Yes and yes.
> > >
> > > > Take a look into WebFaultOutInterceptor. handleMessage(), the code
> might
> > > tell you why WebFaultOutInterceptor did not recognize your exception as
> a
> > > checked exception.
> > >
> > > Looks like it should work, but I can't help thinking that it might be
> > > because my interceptor runs PRE_PROTOCOL. Are we certain that faults
> > > always go through this WebFaultOutInterceptor?
> > >
> >
> > It should, if you are using JAX-WS frontend. Where your interceptor sits
> does not really matter, as when the exception is thrown from the outbound
> interceptor chain, CXF will start a new interceptor chain to deal with
> exceptions (fault out interceptor chain). Can you set your log level to FINE to
> see what interceptors you have in your fault out chain.
> >
> > Thanks,
> > Jervis
> >
> > >
> > > 2007/11/26, Liu, Jervis <jl...@iona.com>:
> > > > Hi, it is possible to throw a checked Exception from CXF interceptors.
> Make
> > > sure the exception thrown from your interceptor is declared as an
> exception
> > > on the operation being invoked, otherwise this exception will not be
> > > recognized as a checked Exception. Also was the MyFault class generated
> by
> > > wsdltojava? does it have the WebFault annotation? The checked
> exception is
> > > unmarshalled by WebFaultOutInterceptor and its super class
> > > FaultOutInterceptor. If the exception is not recognized as checked
> exception
> > > by WebFaultOutInterceptor, the exception will be handled by the default
> > > protocol binding fault interceptors such as Soap11FaultOutInterceptor
> and
> > > Soap12FaultOutInterceptor. Take a look into WebFaultOutInterceptor.
> > > handleMessage(), the code might tell you why WebFaultOutInterceptor
> did
> > > not recognize your exception as a checked exception.
> > > >
> > > > Let me know if you have any further questions,
> > > >
> > > > Jervis
> > > >
> > > > > -----Original Message-----
> > > > > From: Christian Vest Hansen [mailto:karmazilla@gmail.com]
> > > > > Sent: 2007年11月23日 17:56
> > > > > To: cxf-user@incubator.apache.org
> > > > > Subject: Throwing faults from within an Interceptor
> > > > >
> > > > > I have a WSDL that defines MyFault and all of my operations can
> > > > > potentially throw this fault. This fault has some custom elements and
> > > > > stuff, so it is not an ordinary SoapFault, and it got its own
> > > > > Exception class when I generated my Java code.
> > > > >
> > > > > When I throw this fault from within an operation in my
> WebServiceImpl
> > > > > class, all of the custom cruft I put in this fault gets marshalled
> > > > > correctly.
> > > > >
> > > > > However, I also have an Interceptor (that operates in the
> > > > > Phase.PRE_PROTOCOL phase) that want to throw faults as well, and
> > > > > preferably faults defined in my WSDL. So in the Interceptors
> > > > > handleMessage() I do something like this:
> > > > >
> > > > > throw new Fault(new MyFault("Bad stuff"));
> > > > >
> > > > > When I do this, I only get an ordinary soap fault with a "Bad stuff"
> > > > > fault string, but all of the things that are custom to the MyFault
> > > > > dosn't get marshalled properly.
> > > > >
> > > > > So, is there any way that I can remedy this? Can I make an interceptor
> > > > > throw a properly marshalled custom soap fault?
> > > > >
> > > > > CXF version 2.0.3.
> > > > >
> > > > > --
> > > > > Venlig hilsen / Kind regards,
> > > > > Christian Vest Hansen.
> > > >
> > > > ----------------------------
> > > > IONA Technologies PLC (registered in Ireland)
> > > > Registered Number: 171387
> > > > Registered Address: The IONA Building, Shelbourne Road, Dublin 4,
> Ireland
> > > >
> > >
> > >
> > > --
> > > Venlig hilsen / Kind regards,
> > > Christian Vest Hansen.
> >
> > ----------------------------
> > IONA Technologies PLC (registered in Ireland)
> > Registered Number: 171387
> > Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
> >
> 
> 
> --
> Venlig hilsen / Kind regards,
> Christian Vest Hansen.

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

Re: Throwing faults from within an Interceptor

Posted by Christian Vest Hansen <ka...@gmail.com>.
Following is a log-snip at level FINE. The SSOInterceptor is my
fault-trowing interceptor that throws an OperationNotAllowedFault
wrapped in a CXF Fault object.

I notice now that the WebFaultOutInterceptor generates an NPE at line
111 in its handleMessage():
http://fisheye6.cenqua.com/browse/celtixfire/tags/cxf-2.0.3-incubator/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java?r=583877#l111

It looks to me that there's no BindingOperationInfo in the Exchange...
What ever that means.

Log output:
=============================================================
09:11:54,287 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.transport.servlet.ServletController invokeDestination
FINE: Service http request on thread: Thread[http-127.0.0.1-8080-1,5,jboss]
09:11:54,349 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.transport.http.AbstractHTTPDestination setHeaders
FINE: Request Headers: {content-length=[838], host=[localhost:8080],
user-agent=[Jakarta Commons-HttpClient/3.0.1],
content-type=[text/xml;charset=UTF-8],
soapaction=["http://ws.unwire.dk/ldap/Administation/v1/GetAllCustomers"]}
09:11:54,368 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain add
FINE: Adding interceptor
org.apache.cxf.jaxws.handler.logical.LogicalHandlerInInterceptor@30adcb
to phase pre-protocol
09:11:54,369 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain add
FINE: Adding interceptor
org.apache.cxf.jaxws.interceptors.WrapperClassInInterceptor@e224fe to
phase post-logical
09:11:54,369 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain add
FINE: Adding interceptor
org.apache.cxf.jaxws.interceptors.HolderInInterceptor@eacdcc to phase
pre-invoke
09:11:54,369 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain add
FINE: Adding interceptor
org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor@6d1337 to
phase pre-protocol
09:11:54,369 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain add
FINE: Adding interceptor
org.apache.cxf.jaxws.interceptors.SwAInInterceptor@899be to phase
pre-invoke
09:11:54,369 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain add
FINE: Adding interceptor dk.unwire.ws.sso.cxf.SSOInterceptor@a594c2 to
phase pre-protocol
09:11:54,370 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain add
FINE: Adding interceptor
org.apache.cxf.binding.soap.saaj.SAAJInInterceptor@c96812 to phase
pre-protocol
09:11:54,370 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain add
FINE: Adding interceptor
org.apache.cxf.interceptor.AttachmentInInterceptor@cf7ac3 to phase
receive
09:11:54,370 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain add
FINE: Adding interceptor
org.apache.cxf.interceptor.StaxInInterceptor@849b2f to phase
post-stream
09:11:54,370 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain add
FINE: Adding interceptor
org.apache.cxf.binding.soap.interceptor.SoapActionInInterceptor@e86879
to phase read
09:11:54,370 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain add
FINE: Adding interceptor
org.apache.cxf.binding.soap.interceptor.RPCInInterceptor@2305d7 to
phase unmarshal
09:11:54,371 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain add
FINE: Adding interceptor
org.apache.cxf.binding.soap.interceptor.SoapHeaderInterceptor@54838f
to phase unmarshal
09:11:54,371 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain add
FINE: Adding interceptor
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor@8936ff
to phase read
09:11:54,371 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain add
FINE: Adding interceptor
org.apache.cxf.binding.soap.interceptor.MustUnderstandInterceptor@79a8da
to phase pre-protocol
09:11:54,371 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain add
FINE: Adding interceptor
org.apache.cxf.interceptor.URIMappingInterceptor@3cb8df to phase
unmarshal
09:11:54,371 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain add
FINE: Adding interceptor
org.apache.cxf.interceptor.ServiceInvokerInterceptor@8d749a to phase
invoke
09:11:54,372 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain add
FINE: Adding interceptor
org.apache.cxf.interceptor.OutgoingChainInterceptor@e25e8c to phase
post-invoke
09:11:54,374 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain outputChainToLog
FINE: Chain org.apache.cxf.phase.PhaseInterceptorChain@ba30c6 was
created. Current flow:
  receive [AttachmentInInterceptor]
  post-stream [StaxInInterceptor]
  read [ReadHeadersInterceptor, SoapActionInInterceptor]
  pre-protocol [MustUnderstandInterceptor, SOAPHandlerInterceptor,
LogicalHandlerInInterceptor, SAAJInInterceptor, SSOInterceptor]
  unmarshal [URIMappingInterceptor, RPCInInterceptor, SoapHeaderInterceptor]
  post-logical [WrapperClassInInterceptor]
  pre-invoke [SwAInInterceptor, HolderInInterceptor]
  invoke [ServiceInvokerInterceptor]
  post-invoke [OutgoingChainInterceptor]
09:11:54,374 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain doIntercept
FINE: Invoking handleMessage on interceptor
org.apache.cxf.interceptor.AttachmentInInterceptor@cf7ac3
09:11:54,374 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain doIntercept
FINE: Invoking handleMessage on interceptor
org.apache.cxf.interceptor.StaxInInterceptor@849b2f
09:11:54,513 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain doIntercept
FINE: Invoking handleMessage on interceptor
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor@8936ff
09:11:54,521 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain doIntercept
FINE: Invoking handleMessage on interceptor
org.apache.cxf.binding.soap.interceptor.SoapActionInInterceptor@e86879
09:11:54,522 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain doIntercept
FINE: Invoking handleMessage on interceptor
org.apache.cxf.binding.soap.interceptor.MustUnderstandInterceptor@79a8da
09:11:54,524 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain doIntercept
FINE: Invoking handleMessage on interceptor
org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor@6d1337
09:11:54,530 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.jaxws.handler.HandlerChainInvoker <init>
FINE: invoker for chain size: 0
09:11:54,530 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain doIntercept
FINE: Invoking handleMessage on interceptor
org.apache.cxf.jaxws.handler.logical.LogicalHandlerInInterceptor@30adcb
09:11:54,530 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain doIntercept
FINE: Invoking handleMessage on interceptor
org.apache.cxf.binding.soap.saaj.SAAJInInterceptor@c96812
09:11:54,665 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain doIntercept
FINE: Invoking handleMessage on interceptor
dk.unwire.ws.sso.cxf.SSOInterceptor@a594c2
09:11:54,667 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain doIntercept
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Annonymous access denied.
	at dk.unwire.ws.sso.cxf.SSOInterceptor.buildFault(SSOInterceptor.java:198)
	at dk.unwire.ws.sso.cxf.SSOInterceptor.authorizeMessage(SSOInterceptor.java:96)
	at dk.unwire.ws.sso.cxf.SSOInterceptor.handleMessage(SSOInterceptor.java:60)
	at dk.unwire.ws.sso.cxf.SSOInterceptor.handleMessage(SSOInterceptor.java:1)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:207)
	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:73)
	at org.apache.cxf.transport.servlet.ServletDestination.doMessage(ServletDestination.java:79)
	at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:256)
	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
	at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:170)
	at org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServlet.java:148)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	at java.lang.Thread.run(Thread.java:613)
Caused by: dk.unwire.ws.ldap.administration.v1.OperationNotAllowedFault:
Annonymous access denied.
09:11:54,668 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain unwind
FINE: Invoking handleFault on interceptor
dk.unwire.ws.sso.cxf.SSOInterceptor@a594c2
09:11:54,668 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain unwind
FINE: Invoking handleFault on interceptor
org.apache.cxf.binding.soap.saaj.SAAJInInterceptor@c96812
09:11:54,668 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain unwind
FINE: Invoking handleFault on interceptor
org.apache.cxf.jaxws.handler.logical.LogicalHandlerInInterceptor@30adcb
09:11:54,668 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain unwind
FINE: Invoking handleFault on interceptor
org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor@6d1337
09:11:54,669 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain unwind
FINE: Invoking handleFault on interceptor
org.apache.cxf.binding.soap.interceptor.MustUnderstandInterceptor@79a8da
09:11:54,669 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain unwind
FINE: Invoking handleFault on interceptor
org.apache.cxf.binding.soap.interceptor.SoapActionInInterceptor@e86879
09:11:54,669 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain unwind
FINE: Invoking handleFault on interceptor
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor@8936ff
09:11:54,669 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain unwind
FINE: Invoking handleFault on interceptor
org.apache.cxf.interceptor.StaxInInterceptor@849b2f
09:11:54,669 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain unwind
FINE: Invoking handleFault on interceptor
org.apache.cxf.interceptor.AttachmentInInterceptor@cf7ac3
09:11:54,670 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain add
FINE: Adding interceptor
org.apache.cxf.interceptor.MessageSenderInterceptor@91eb59 to phase
prepare-send
09:11:54,670 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain add
FINE: Adding interceptor
org.apache.cxf.jaxws.handler.logical.LogicalHandlerFaultOutInterceptor@f224f7
to phase pre-marshal
09:11:54,670 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain add
FINE: Adding interceptor
org.apache.cxf.jaxws.handler.soap.SOAPHandlerFaultOutInterceptor@58fa91
to phase pre-protocol
09:11:54,671 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain add
FINE: Adding interceptor
org.apache.cxf.interceptor.StaxOutInterceptor@aa767e to phase
pre-stream
09:11:54,671 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain add
FINE: Adding interceptor
org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor@49707d to
phase write
09:11:54,671 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain add
FINE: Adding interceptor
org.apache.cxf.binding.soap.interceptor.Soap11FaultOutInterceptor@785ecd
to phase marshal
09:11:54,671 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain add
FINE: Adding interceptor
org.apache.cxf.jaxws.interceptors.WebFaultOutInterceptor@981635 to
phase pre-protocol
09:11:54,671 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain outputChainToLog
FINE: Chain org.apache.cxf.phase.PhaseInterceptorChain@da3281 was
created. Current flow:
  prepare-send [MessageSenderInterceptor]
  pre-stream [StaxOutInterceptor]
  pre-protocol [SOAPHandlerFaultOutInterceptor, WebFaultOutInterceptor]
  write [SoapOutInterceptor]
  pre-marshal [LogicalHandlerFaultOutInterceptor]
  marshal [Soap11FaultOutInterceptor]
09:11:54,672 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain doIntercept
FINE: Invoking handleMessage on interceptor
org.apache.cxf.interceptor.MessageSenderInterceptor@91eb59
09:11:54,677 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain add
FINE: Adding interceptor
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor@123c4a
to phase prepare-send-ending
09:11:54,677 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain outputChainToLog
FINE: Chain org.apache.cxf.phase.PhaseInterceptorChain@da3281 was
modified. Current flow:
  prepare-send [MessageSenderInterceptor]
  pre-stream [StaxOutInterceptor]
  pre-protocol [SOAPHandlerFaultOutInterceptor, WebFaultOutInterceptor]
  write [SoapOutInterceptor]
  pre-marshal [LogicalHandlerFaultOutInterceptor]
  marshal [Soap11FaultOutInterceptor]
  prepare-send-ending [MessageSenderEndingInterceptor]
09:11:54,677 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain doIntercept
FINE: Invoking handleMessage on interceptor
org.apache.cxf.interceptor.StaxOutInterceptor@aa767e
09:11:54,685 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain add
FINE: Adding interceptor
org.apache.cxf.interceptor.StaxOutInterceptor$StaxOutEndingInterceptor@1b48a
to phase pre-stream-ending
09:11:54,686 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain outputChainToLog
FINE: Chain org.apache.cxf.phase.PhaseInterceptorChain@da3281 was
modified. Current flow:
  prepare-send [MessageSenderInterceptor]
  pre-stream [StaxOutInterceptor]
  pre-protocol [SOAPHandlerFaultOutInterceptor, WebFaultOutInterceptor]
  write [SoapOutInterceptor]
  pre-marshal [LogicalHandlerFaultOutInterceptor]
  marshal [Soap11FaultOutInterceptor]
  pre-stream-ending [StaxOutEndingInterceptor]
  prepare-send-ending [MessageSenderEndingInterceptor]
09:11:54,686 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain doIntercept
FINE: Invoking handleMessage on interceptor
org.apache.cxf.jaxws.handler.soap.SOAPHandlerFaultOutInterceptor@58fa91
09:11:54,686 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain doIntercept
FINE: Invoking handleMessage on interceptor
org.apache.cxf.jaxws.interceptors.WebFaultOutInterceptor@981635
09:11:54,691 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.jaxws.interceptors.WebFaultOutInterceptor handleMessage
WARNING: EXCEPTION_WHILE_WRITING_FAULT
java.lang.NullPointerException
	at org.apache.cxf.jaxws.interceptors.WebFaultOutInterceptor.handleMessage(WebFaultOutInterceptor.java:111)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:207)
	at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:90)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:224)
	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:73)
	at org.apache.cxf.transport.servlet.ServletDestination.doMessage(ServletDestination.java:79)
	at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:256)
	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
	at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:170)
	at org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServlet.java:148)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	at java.lang.Thread.run(Thread.java:613)
09:11:54,691 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain doIntercept
FINE: Invoking handleMessage on interceptor
org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor@49707d
09:11:54,695 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain add
FINE: Adding interceptor
org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEndingInterceptor@c54858
to phase write-ending
09:11:54,695 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain outputChainToLog
FINE: Chain org.apache.cxf.phase.PhaseInterceptorChain@da3281 was
modified. Current flow:
  prepare-send [MessageSenderInterceptor]
  pre-stream [StaxOutInterceptor]
  pre-protocol [SOAPHandlerFaultOutInterceptor, WebFaultOutInterceptor]
  write [SoapOutInterceptor]
  pre-marshal [LogicalHandlerFaultOutInterceptor]
  marshal [Soap11FaultOutInterceptor]
  write-ending [SoapOutEndingInterceptor]
  pre-stream-ending [StaxOutEndingInterceptor]
  prepare-send-ending [MessageSenderEndingInterceptor]
09:11:54,695 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain doIntercept
FINE: Invoking handleMessage on interceptor
org.apache.cxf.jaxws.handler.logical.LogicalHandlerFaultOutInterceptor@f224f7
09:11:54,695 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain doIntercept
FINE: Invoking handleMessage on interceptor
org.apache.cxf.binding.soap.interceptor.Soap11FaultOutInterceptor@785ecd
09:11:54,697 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain doIntercept
FINE: Invoking handleMessage on interceptor
org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEndingInterceptor@c54858
09:11:54,697 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain doIntercept
FINE: Invoking handleMessage on interceptor
org.apache.cxf.interceptor.StaxOutInterceptor$StaxOutEndingInterceptor@1b48a
09:11:54,697 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.phase.PhaseInterceptorChain doIntercept
FINE: Invoking handleMessage on interceptor
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor@123c4a
09:11:54,704 ERROR [STDERR] Nov 27, 2007 9:11:54 AM
org.apache.cxf.transport.servlet.ServletDestination doMessage
FINE: Finished servicing http request on thread:
Thread[http-127.0.0.1-8080-1,5,jboss]




2007/11/27, Liu, Jervis <jl...@iona.com>:
>
>
> > -----Original Message-----
> > From: Christian Vest Hansen [mailto:karmazilla@gmail.com]
> > Sent: 2007年11月26日 18:36
> > To: cxf-user@incubator.apache.org
> > Subject: Re: Throwing faults from within an Interceptor
> >
> > Hello Jervis.
> >
> > > Make sure the exception thrown from your interceptor is declared as an
> > exception on the operation being invoked
> >
> > It is. It is declared to be thrown in the WSDL and on my implementation
> > methods.
> >
> > > was the MyFault class generated by wsdltojava? does it have the WebFault
> > annotation?
> >
> > Yes and yes.
> >
> > > Take a look into WebFaultOutInterceptor. handleMessage(), the code might
> > tell you why WebFaultOutInterceptor did not recognize your exception as a
> > checked exception.
> >
> > Looks like it should work, but I can't help thinking that it might be
> > because my interceptor runs PRE_PROTOCOL. Are we certain that faults
> > always go through this WebFaultOutInterceptor?
> >
>
> It should, if you are using JAX-WS frontend. Where your interceptor sits does not really matter, as when the exception is thrown from the outbound interceptor chain, CXF will start a new interceptor chain to deal with exceptions (fault out interceptor chain). Can you set your log level to FINE to see what interceptors you have in your fault out chain.
>
> Thanks,
> Jervis
>
> >
> > 2007/11/26, Liu, Jervis <jl...@iona.com>:
> > > Hi, it is possible to throw a checked Exception from CXF interceptors. Make
> > sure the exception thrown from your interceptor is declared as an exception
> > on the operation being invoked, otherwise this exception will not be
> > recognized as a checked Exception. Also was the MyFault class generated by
> > wsdltojava? does it have the WebFault annotation? The checked exception is
> > unmarshalled by WebFaultOutInterceptor and its super class
> > FaultOutInterceptor. If the exception is not recognized as checked exception
> > by WebFaultOutInterceptor, the exception will be handled by the default
> > protocol binding fault interceptors such as Soap11FaultOutInterceptor and
> > Soap12FaultOutInterceptor. Take a look into WebFaultOutInterceptor.
> > handleMessage(), the code might tell you why WebFaultOutInterceptor did
> > not recognize your exception as a checked exception.
> > >
> > > Let me know if you have any further questions,
> > >
> > > Jervis
> > >
> > > > -----Original Message-----
> > > > From: Christian Vest Hansen [mailto:karmazilla@gmail.com]
> > > > Sent: 2007年11月23日 17:56
> > > > To: cxf-user@incubator.apache.org
> > > > Subject: Throwing faults from within an Interceptor
> > > >
> > > > I have a WSDL that defines MyFault and all of my operations can
> > > > potentially throw this fault. This fault has some custom elements and
> > > > stuff, so it is not an ordinary SoapFault, and it got its own
> > > > Exception class when I generated my Java code.
> > > >
> > > > When I throw this fault from within an operation in my WebServiceImpl
> > > > class, all of the custom cruft I put in this fault gets marshalled
> > > > correctly.
> > > >
> > > > However, I also have an Interceptor (that operates in the
> > > > Phase.PRE_PROTOCOL phase) that want to throw faults as well, and
> > > > preferably faults defined in my WSDL. So in the Interceptors
> > > > handleMessage() I do something like this:
> > > >
> > > > throw new Fault(new MyFault("Bad stuff"));
> > > >
> > > > When I do this, I only get an ordinary soap fault with a "Bad stuff"
> > > > fault string, but all of the things that are custom to the MyFault
> > > > dosn't get marshalled properly.
> > > >
> > > > So, is there any way that I can remedy this? Can I make an interceptor
> > > > throw a properly marshalled custom soap fault?
> > > >
> > > > CXF version 2.0.3.
> > > >
> > > > --
> > > > Venlig hilsen / Kind regards,
> > > > Christian Vest Hansen.
> > >
> > > ----------------------------
> > > IONA Technologies PLC (registered in Ireland)
> > > Registered Number: 171387
> > > Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
> > >
> >
> >
> > --
> > Venlig hilsen / Kind regards,
> > Christian Vest Hansen.
>
> ----------------------------
> IONA Technologies PLC (registered in Ireland)
> Registered Number: 171387
> Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
>


-- 
Venlig hilsen / Kind regards,
Christian Vest Hansen.

RE: Throwing faults from within an Interceptor

Posted by "Liu, Jervis" <jl...@iona.com>.

> -----Original Message-----
> From: Christian Vest Hansen [mailto:karmazilla@gmail.com]
> Sent: 2007年11月26日 18:36
> To: cxf-user@incubator.apache.org
> Subject: Re: Throwing faults from within an Interceptor
> 
> Hello Jervis.
> 
> > Make sure the exception thrown from your interceptor is declared as an
> exception on the operation being invoked
> 
> It is. It is declared to be thrown in the WSDL and on my implementation
> methods.
> 
> > was the MyFault class generated by wsdltojava? does it have the WebFault
> annotation?
> 
> Yes and yes.
> 
> > Take a look into WebFaultOutInterceptor. handleMessage(), the code might
> tell you why WebFaultOutInterceptor did not recognize your exception as a
> checked exception.
> 
> Looks like it should work, but I can't help thinking that it might be
> because my interceptor runs PRE_PROTOCOL. Are we certain that faults
> always go through this WebFaultOutInterceptor?
> 

It should, if you are using JAX-WS frontend. Where your interceptor sits does not really matter, as when the exception is thrown from the outbound interceptor chain, CXF will start a new interceptor chain to deal with exceptions (fault out interceptor chain). Can you set your log level to FINE to see what interceptors you have in your fault out chain. 

Thanks,
Jervis

> 
> 2007/11/26, Liu, Jervis <jl...@iona.com>:
> > Hi, it is possible to throw a checked Exception from CXF interceptors. Make
> sure the exception thrown from your interceptor is declared as an exception
> on the operation being invoked, otherwise this exception will not be
> recognized as a checked Exception. Also was the MyFault class generated by
> wsdltojava? does it have the WebFault annotation? The checked exception is
> unmarshalled by WebFaultOutInterceptor and its super class
> FaultOutInterceptor. If the exception is not recognized as checked exception
> by WebFaultOutInterceptor, the exception will be handled by the default
> protocol binding fault interceptors such as Soap11FaultOutInterceptor and
> Soap12FaultOutInterceptor. Take a look into WebFaultOutInterceptor.
> handleMessage(), the code might tell you why WebFaultOutInterceptor did
> not recognize your exception as a checked exception.
> >
> > Let me know if you have any further questions,
> >
> > Jervis
> >
> > > -----Original Message-----
> > > From: Christian Vest Hansen [mailto:karmazilla@gmail.com]
> > > Sent: 2007年11月23日 17:56
> > > To: cxf-user@incubator.apache.org
> > > Subject: Throwing faults from within an Interceptor
> > >
> > > I have a WSDL that defines MyFault and all of my operations can
> > > potentially throw this fault. This fault has some custom elements and
> > > stuff, so it is not an ordinary SoapFault, and it got its own
> > > Exception class when I generated my Java code.
> > >
> > > When I throw this fault from within an operation in my WebServiceImpl
> > > class, all of the custom cruft I put in this fault gets marshalled
> > > correctly.
> > >
> > > However, I also have an Interceptor (that operates in the
> > > Phase.PRE_PROTOCOL phase) that want to throw faults as well, and
> > > preferably faults defined in my WSDL. So in the Interceptors
> > > handleMessage() I do something like this:
> > >
> > > throw new Fault(new MyFault("Bad stuff"));
> > >
> > > When I do this, I only get an ordinary soap fault with a "Bad stuff"
> > > fault string, but all of the things that are custom to the MyFault
> > > dosn't get marshalled properly.
> > >
> > > So, is there any way that I can remedy this? Can I make an interceptor
> > > throw a properly marshalled custom soap fault?
> > >
> > > CXF version 2.0.3.
> > >
> > > --
> > > Venlig hilsen / Kind regards,
> > > Christian Vest Hansen.
> >
> > ----------------------------
> > IONA Technologies PLC (registered in Ireland)
> > Registered Number: 171387
> > Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
> >
> 
> 
> --
> Venlig hilsen / Kind regards,
> Christian Vest Hansen.

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

Re: Throwing faults from within an Interceptor

Posted by Christian Vest Hansen <ka...@gmail.com>.
Hello Jervis.

> Make sure the exception thrown from your interceptor is declared as an exception on the operation being invoked

It is. It is declared to be thrown in the WSDL and on my implementation methods.

> was the MyFault class generated by wsdltojava? does it have the WebFault annotation?

Yes and yes.

> Take a look into WebFaultOutInterceptor. handleMessage(), the code might tell you why WebFaultOutInterceptor did not recognize your exception as a checked exception.

Looks like it should work, but I can't help thinking that it might be
because my interceptor runs PRE_PROTOCOL. Are we certain that faults
always go through this WebFaultOutInterceptor?


2007/11/26, Liu, Jervis <jl...@iona.com>:
> Hi, it is possible to throw a checked Exception from CXF interceptors. Make sure the exception thrown from your interceptor is declared as an exception on the operation being invoked, otherwise this exception will not be recognized as a checked Exception. Also was the MyFault class generated by wsdltojava? does it have the WebFault annotation? The checked exception is unmarshalled by WebFaultOutInterceptor and its super class FaultOutInterceptor. If the exception is not recognized as checked exception by WebFaultOutInterceptor, the exception will be handled by the default protocol binding fault interceptors such as Soap11FaultOutInterceptor and Soap12FaultOutInterceptor. Take a look into WebFaultOutInterceptor. handleMessage(), the code might tell you why WebFaultOutInterceptor did not recognize your exception as a checked exception.
>
> Let me know if you have any further questions,
>
> Jervis
>
> > -----Original Message-----
> > From: Christian Vest Hansen [mailto:karmazilla@gmail.com]
> > Sent: 2007年11月23日 17:56
> > To: cxf-user@incubator.apache.org
> > Subject: Throwing faults from within an Interceptor
> >
> > I have a WSDL that defines MyFault and all of my operations can
> > potentially throw this fault. This fault has some custom elements and
> > stuff, so it is not an ordinary SoapFault, and it got its own
> > Exception class when I generated my Java code.
> >
> > When I throw this fault from within an operation in my WebServiceImpl
> > class, all of the custom cruft I put in this fault gets marshalled
> > correctly.
> >
> > However, I also have an Interceptor (that operates in the
> > Phase.PRE_PROTOCOL phase) that want to throw faults as well, and
> > preferably faults defined in my WSDL. So in the Interceptors
> > handleMessage() I do something like this:
> >
> > throw new Fault(new MyFault("Bad stuff"));
> >
> > When I do this, I only get an ordinary soap fault with a "Bad stuff"
> > fault string, but all of the things that are custom to the MyFault
> > dosn't get marshalled properly.
> >
> > So, is there any way that I can remedy this? Can I make an interceptor
> > throw a properly marshalled custom soap fault?
> >
> > CXF version 2.0.3.
> >
> > --
> > Venlig hilsen / Kind regards,
> > Christian Vest Hansen.
>
> ----------------------------
> IONA Technologies PLC (registered in Ireland)
> Registered Number: 171387
> Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
>


-- 
Venlig hilsen / Kind regards,
Christian Vest Hansen.

RE: Throwing faults from within an Interceptor

Posted by "Liu, Jervis" <jl...@iona.com>.
Hi, it is possible to throw a checked Exception from CXF interceptors. Make sure the exception thrown from your interceptor is declared as an exception on the operation being invoked, otherwise this exception will not be recognized as a checked Exception. Also was the MyFault class generated by wsdltojava? does it have the WebFault annotation? The checked exception is unmarshalled by WebFaultOutInterceptor and its super class FaultOutInterceptor. If the exception is not recognized as checked exception by WebFaultOutInterceptor, the exception will be handled by the default protocol binding fault interceptors such as Soap11FaultOutInterceptor and Soap12FaultOutInterceptor. Take a look into WebFaultOutInterceptor. handleMessage(), the code might tell you why WebFaultOutInterceptor did not recognize your exception as a checked exception.

Let me know if you have any further questions,

Jervis

> -----Original Message-----
> From: Christian Vest Hansen [mailto:karmazilla@gmail.com]
> Sent: 2007年11月23日 17:56
> To: cxf-user@incubator.apache.org
> Subject: Throwing faults from within an Interceptor
> 
> I have a WSDL that defines MyFault and all of my operations can
> potentially throw this fault. This fault has some custom elements and
> stuff, so it is not an ordinary SoapFault, and it got its own
> Exception class when I generated my Java code.
> 
> When I throw this fault from within an operation in my WebServiceImpl
> class, all of the custom cruft I put in this fault gets marshalled
> correctly.
> 
> However, I also have an Interceptor (that operates in the
> Phase.PRE_PROTOCOL phase) that want to throw faults as well, and
> preferably faults defined in my WSDL. So in the Interceptors
> handleMessage() I do something like this:
> 
> throw new Fault(new MyFault("Bad stuff"));
> 
> When I do this, I only get an ordinary soap fault with a "Bad stuff"
> fault string, but all of the things that are custom to the MyFault
> dosn't get marshalled properly.
> 
> So, is there any way that I can remedy this? Can I make an interceptor
> throw a properly marshalled custom soap fault?
> 
> CXF version 2.0.3.
> 
> --
> Venlig hilsen / Kind regards,
> Christian Vest Hansen.

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland