The only way I could figure out to do it was to change the JBossWS source code 
in RequestHandlerImpl. It's a small change, but since it violates the "must 
return a 500 on fault" rule, I doubt it's going to get added as a perm fix. I 
wish there was a way to make flex work with the 500 error code :-( ... The fix 
is for the 2.0.0.GA source under org.jboss.wsf.stack.jbws.RequestHandlerImpl at 
line 287.. change it to..

            if (httpResponse != null && code == null && isFault)
  |             {
  |                
httpResponse.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
  |             }
  | 

This way.. if the response code is set in a handler, it overrides the 500 
response code. The only thing left to do is register a handler on the web 
service via the @HandlerChain annotation. The handler should have the following 
method...

        /*
  |      * (non-Javadoc)
  |      * 
  |      * @see 
javax.xml.ws.handler.Handler#close(javax.xml.ws.handler.MessageContext)
  |      */
  |     public void close(MessageContext context) {
  |             context.put(MessageContextJAXWS.HTTP_RESPONSE_CODE, new 
Integer(200));
  |             context.setScope(MessageContextJAXWS.HTTP_RESPONSE_CODE, 
Scope.APPLICATION);
  |     }
  | 

And.. voila.. it should work with Flex. Note that this will change all 500 
responses from web services to 200s. A better approach might be to add code to 
the handler to check if it's Flex requesting the data (via the ServletRequst 
passed in the message context) and only change the code in that instance.

Hope that helps,
Derek

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111337#4111337

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111337
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to