I tried it and it didn't seem to work.  A Http response code of 500 is still
being returned.  

Below is the way I am setting up my server, web service, and the fault
interceptor. The interceptor's handleMessage does get called when a fault is
throw, the handleFault method never gets called.  Not quite sure if it is
supposed to or not though.  Perhaps I am setting up the interceptor
incorrectly??? 

              //create http server
              Server server = new Server(usePort);

              //set up the handlers for the web server
              HandlerList handlers = new HandlerList();

              //set up web service handler
              Context root = new Context(handlers, "/", Context.SESSIONS);
              CXFServlet  cxf = new CXFServlet();
              ServletHolder servlet = new ServletHolder(cxf);
              servlet.setName("soap");
              servlet.setForcedPath("soap");
              root.addServlet(servlet, "/*");
                
              //set up file handler
              ResourceHandler resourceHandler = new ResourceHandler();
             
resourceHandler.setResourceBase(IntegratorConfigurationHelper.WEB_SERVER_ROOT);
              handlers.setHandlers(new Handler[] {resourceHandler, root, new
DefaultHandler()});
              server.setHandler(handlers);
              
              //start the server
              server.start();
                
              //set bus information
              Bus bus = cxf.getBus();
              bus.getOutFaultInterceptors().add(new FaultInterceptor());
              BusFactory.setDefaultBus(bus);
                
              //Publish service for consumption
              Logger.log(Level.INFO, "Publishing: " + url);
              Endpoint.publish(path, myWs);




Interceptor code:
              public class FaultInterceptor extends  FaultOutInterceptor {
        
                  public void handleMessage(Message message) 
                  {
                        message.put(Message.RESPONSE_CODE, 200);
                  }
    
                  public void handleFault(Message message)
                  {
        
                  }
              }


Any other ideas on what I could try?






dkulp wrote:
> 
> 
> You would probably need to add an interceptor onto the FaultOutChain that
> sets 
> the Message.RESPONSE_CODE property on the message to 200.    I THINK that
> will 
> work.
> 
> Dan
> 
> 
> On Fri April 3 2009 2:44:52 pm stargex wrote:
>> I have created a CXF 2.1.3 web service server and I have a Flex client. 
>> The problem I am having is that I need faults to return with a HTTP
>> response code of 200 and not 500.  Flex can't get any fault information
>> when they are sent with a HTTP code of 500.
>>
>> I have looked and I can't seem to figure out how to change the response
>> code sent by my CXF web service.  Is it possible to do this and if so how
>> can I do it?
>>
>> If it makes a difference I have created pro grammatically and not through
>> SPRING.
>>
>> Any help would be greatly appreciated.  Thanks.
> 
> -- 
> Daniel Kulp
> [email protected]
> http://www.dankulp.com/blog
> 
> 

-- 
View this message in context: 
http://www.nabble.com/CXF-Fault-Response-Code-tp22874000p22876870.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to