On Thu October 1 2009 5:35:41 pm Arik Gorelik wrote:
> I think i got it to work using
> 
>    getBefore().add(DocLiteralInInterceptor.class.getName());
>
> instead of
> 
> addBefore(DocLiteralInInterceptor.class.getName());

Not sure why that would make a difference.  The code for the two methods:
    public void addBefore(String i) {
        before.add(i);
    }
    public final Set<String> getBefore() {
        return before;
    }

Thus, they should be exactly equivalent.


> I have to try it out more to be sure.
> 
> The reason I want to throw my faults before DocLiteralInInterceptor is
> because it was causing an issue that you previously commented on (explicit
> validation is not being swallowed anymore so my errors are never thrown).
> However, now I am running into problems where throwing my fault before the
> DocLiteralInInterceptor gives me back an incomplete fault. What I mean is
> that I have a special type of exception that is part of my service schema,
> called TestException, which I dump into the Fault constructor (new Fault
> (Throwable..)) and that type is only available to me AFTER
> DocLiteralInInterceptor.
> 
> Basically, my problemh is that I cannot get past DocLiteralInInterceptor if
>  I have input validation errors which were silent in 2.2.3. I am wondering
>  if I could turn it off someow?

You can right now, it's just a bit tricky.   If you configure the 
JAXBDataBinding object to have a ValidationEventHandler property that points 
to an object of your own that implements ValidationEventHandler (single 
method) that does nothing except return true (or maybe return 
event.getSeverity()!=ValidationEvent.FATAL_ERROR), it should work fine.     
Basically, that's what has changed was that we now call:

unmarshaller.setEventHandler(null);

which, interestingly enough, sets an event handler that is different than the 
default event handler, despite what the javadoc says.   By configuring in your 
own event handler, we send that in instead.

In anycase, we can make it easier by adding a property.   That shouldn't be 
too much of an issue.

Dan

 
> On Thu, Oct 1, 2009 at 2:24 PM, Daniel Kulp <[email protected]> wrote:
> > Can you create a small test case and attach to the jira?
> >
> > When debugging, if you click on the chain object itself, it should print
> > the
> > chain.   Is your interceptor in there anywhere at all?
> >
> > Out of curiosity, why would you not just throw a fault from the first
> > interceptor?  Why save it and throw it later?  Seems strange to me.
> >
> > Dan
> >
> > On Thu October 1 2009 3:29:49 pm Arik Gorelik wrote:
> > > Hello All,
> > >
> > > I am using CXF 2.2.4-SNAPSHOT and running into a strange issue.
> > >
> > > I have a custom interceptor that does not do anything other than throw
> > > a fault if it has one as a content of the incoming message. I am trying
> > > to execute it BEFORE DocLiteralInInterceptor but AFTER
> > > URIMappingInterceptor in UNMARSHAL phase.
> > >
> > > This is how I am adding it for for some reason it does not fire (it is
> > >  being skipped):
> > >
> > > public class TestFaultThrowingInterceptor extends
> > > AbstractPhaseInterceptor<Message> {
> > >
> > >        public TestFaultThrowingInterceptor() {
> > >                super(Phase.UNMARSHAL);
> > >               addAfter(URIMappingInterceptor.class.getName());
> > >                addBefore(DocLiteralInInterceptor.class.getName());
> > >        }
> > >
> > >       public void handleMessage(Message message) throws Fault {
> > >                // Obtain the fault from the previous phases
> > >                Fault fault = (Fault)
> > > message.getContent(Exception.class); if (fault != null) {
> > >                        throw fault;
> > >                 }
> > >        }
> > >
> > > }
> > >
> > > <jaxws:endpoint
> > >            id="testService"
> > >            implementor="testServiceImpl"
> > >            wsdlLocation="wsdl/v29/testService.wsdl"
> > >            address="/v29/testService">
> > >            <jaxws:properties>
> > >                <entry key="schema-validation-enabled" value="false" />
> > >            </jaxws:properties>
> > >            <jaxws:inInterceptors>
> > >                <ref bean="testInterceptor" />
> > >                 <ref bean="testFaultThrowingInterceptor" />
> > >            </jaxws:inInterceptors>
> > >    </jaxws:endpoint>
> > >
> > >
> > > However, I've been debugging the code including the Interceptor Chain,
> >
> > but
> >
> > > not sure why my custom interceptor does not fire. After the
> > > URIMappingInterceptor the execution in the chain goes straight to the
> > > DocLiteralInInterceptor. Any ideas how I can invoke my interceptor?
> > >
> > > Thanks.
> > > Arik.
> >
> > --
> > Daniel Kulp
> > [email protected]
> > http://www.dankulp.com/blog
> 

-- 
Daniel Kulp
[email protected]
http://www.dankulp.com/blog

Reply via email to