[ 
https://issues.apache.org/jira/browse/CXF-999?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Noel Trout updated CXF-999:
---------------------------

    Attachment: HttpErrorCodeFaultInterceptor.java

Custom interceptor that gets the HTTP response code set correctly....

> SOAP 1.1 Fault returned with HTTP 200 status code
> -------------------------------------------------
>
>                 Key: CXF-999
>                 URL: https://issues.apache.org/jira/browse/CXF-999
>             Project: CXF
>          Issue Type: Bug
>          Components: Transports
>    Affects Versions: 2.0.1
>         Environment: Windows XP, Orion Server 2.0.7
>            Reporter: Noel Trout
>         Attachments: HttpErrorCodeFaultInterceptor.java
>
>
> We have enabled schema validation for JAXB bindings.  However, if 
> unmarshalling fails because of invalid XML, a SOAP fault is returned 
> correctly but the HTTP response code is 200.  I am expecting an HTTP response 
> code of 500, as it is my understanding this is part of the SOAP 1.1 
> specification.
> --  In case of a SOAP error while processing the request, the SOAP HTTP 
> server MUST issue an HTTP 500 "Internal Server Error" response and include a 
> SOAP message in the response containing a SOAP Fault element (see section 
> 4.4) indicating the SOAP processing error. --
> It appears that the class Soap11FaultOutInterceptor is trying to set the 
> response code correctly with the following:
> message.put(org.apache.cxf.message.Message.RESPONSE_CODE, new Integer(500));
> However, this appears to be happening too late.  I have a suspicion that it 
> is happening too late in the interceptor chain.  I have a temporary fix in 
> place.  I have registered a custom fault out interceptor.  It uses the exact 
> same code as in Soap11FaultOutInterceptor, but my interceptor is running in 
> phase Phase.SETUP on the outbound fault chain.  With my custom interceptor 
> registered, the HTTP response code is correctly set to 500.  See sample from 
> services.xml below....
> <jaxws:endpoint id="PartnerSSOWebService" 
> wsdlLocation="xml/wsdl/PartnerSSOWebService.wsdl" address="/PartnerSSO.ws">
>         <jaxws:implementor>
>             <ref bean="PartnerSSOWebServiceImpl" /> 
>         </jaxws:implementor>
>         <jaxws:inInterceptors>
>             <ref bean="DOMInflowInterceptor" />
>             <ref bean="WSSecurityInflowInterceptor" />
>         </jaxws:inInterceptors>   
>         <jaxws:outFaultInterceptors>
>             <ref bean="HttpErrorCodeFaultInterceptor" />
>         </jaxws:outFaultInterceptors>     
>         <jaxws:properties>
>             <entry key="schema-validation-enabled" value="true" />
>         </jaxws:properties>
>     </jaxws:endpoint>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to