cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kouss <kechoind...@gmail.com>
Subject Re: Custom Exceptions mapping to SOAP Faults
Date Thu, 08 Jan 2009 13:30:37 GMT

Hi,

I have a problem with CXF Soap faults.
I have a wsdl in which I have defined a custom Fault (BadCredentialsFault).
Below is a part of the wsdl : 

....
       <xsd:element name="BadCredentialsFault"
type="tns:BadCredentialsFault" />
       <xsd:complexType name="BadCredentialsFault">
             <xsd:sequence>
                    <xsd:element name="message"
type="xsd:string"></xsd:element>
             </xsd:sequence>
       </xsd:complexType>
...
    <wsdl:message name="BadCredentialsException">
        <wsdl:part name="BadCredentialsException"
element="tns:BadCredentialsFault"></wsdl:part>
    </wsdl:message>
....
    <wsdl:portType name="AuthenticationService">
        <wsdl:operation name="authenticate">
            <wsdl:input message="tns:authenticateRequest" />
            <wsdl:output message="tns:authenticateResponse" />
            <wsdl:fault name="BadCredentialsException"
message="tns:BadCredentialsException"/>
        </wsdl:operation>
...
<wsdl:binding name="authenticationServiceSoapBinding"
type="tns:AuthenticationService">
        <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
        <wsdl:operation name="authenticate">
            <soap:operation
soapAction="http://www.sfr.com/ws/psw/authentication/v1.0/authentication" />
            <wsdl:input>
                <soap:body use="literal" />
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal" />
            </wsdl:output>
            <wsdl:fault name="BadCredentialsException">
                <soap:fault name="BadCredentialsException" use="literal"/>
            </wsdl:fault>

On the client side I absolutely need to have a BadCredentialsException
instead of SOAPFaultException but I notice that CXF wrapps my custom
exception BadCredentialsException into a  SOAPFaultException...
I have this xml flow : note that <detail> element is empty 
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Server</faultcode>
         <faultstring>Bad credentials for login 'tata'</faultstring>
         <detail>
            <stackTrace xmlns="http://schemas.xmlsoap.org/soap/envelope/"/>
         </detail>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>

Is there a way to get the real exception on the client side instead of a
SoapFaultException?

Thanks.
-- 
View this message in context: http://www.nabble.com/Custom-Exceptions-mapping-to-SOAP-Faults-tp19400125p21351795.html
Sent from the cxf-user mailing list archive at Nabble.com.


Mime
View raw message