Richard,

I looked into this yesterday and I think it's fixed in 2.0.2 as part of 
CXF-926.   Basically, a bunch of things were wrong in the handling of 
the @WebFault annotation in 2.0 and 2.0.1.    They should be fixed in 
2.0.2.

However, one of the things that was wrong was the code generator that 
generates the faults.   That is also fixed in 2.0.2, but it does mean 
you will need to re-run the wsdl2java on the wsdl to generate new fault 
classes.   Otherwise, the information in the @WebFault annotation is 
wrong and CXF will not be able to figure out how to properly map that 
to/from the on-the-wire soap faults.

In anycase, if I change your sample you attached to the issues so the 
proper namespaces are in the WebFault annotations, the sample does work 
and the correct MemberExistsFault is caught on the client.

Dan



On Sunday 23 September 2007, Richard Mixon wrote:
> Jervis/Daniel/anyone,
>
> I pasted the code (a simplified Eclipse project) that duplicates the
> problem in the following JIRA issue last weekend. No comments yet, can
> someone take a look?
>
>   https://issues.apache.org/jira/browse/CXF-1028
>
> Thank you - Richard
>
> > From: "Liu, Jervis" <[EMAIL PROTECTED]>
> > Reply-To: <[email protected]>
> > Date: Thu, 13 Sep 2007 07:10:21 -0400
> > To: <[email protected]>
> > Conversation: Not able to catch desired Fault type
> > Subject: RE: Not able to catch desired Fault type
> >
> > Your WSDL snippet and the response message look ok. You may want to
> > send out your WSDL file and client/server code (or paste them in a
> > JIRA), so that we can have a quick debug to see whats going wrong
> > there.
> >
> > Thanks,
> > Jervis
> >
> >> -----Original Message-----
> >> From: Richard Mixon [mailto:[EMAIL PROTECTED]
> >> Sent: 2007?9?13? 11:16
> >> To: [email protected]
> >> Subject: Not able to catch desired Fault type
> >>
> >>
> >> I would appreciate some help trying to understand how to
> >> catch faults that
> >> are defined in my WSDL in a Java client.
> >>
> >> My web service appears to be correctly throwing a specific Fault -
> >> MemberExistsFault - when trying to add a record and the member
> >> already exists.
> >>
> >> However when I catch it on the client, I am not able to catch a
> >> MemberExistsFault. Instead the exception can be caught as a
> >>     javax.xml.ws.soap.SOAPFaultException
> >> which in turn has a cause of
> >>     org.apache.cxf.binding.soap.SoapFault.
> >>
> >>
> >> Here is what the log shows on the server:
> >> INFO: Outbound Message
> >> --------------------------------------
> >> <soap:Envelope
> >> xmlns:soap="http://www.w3.org/2003/05/soap-envelope";> <soap:Body>
> >>     <soap:Fault>
> >>       <soap:Code>
> >>         <soap:Value>soap:Receiver</soap:Value>
> >>       </soap:Code>
> >>       <soap:Reason>
> >>         <soap:Text xml:lang ="en">
> >>           Member cannot be added, it is already in the database
> >>         </soap:Text>
> >>       </soap:Reason>
> >>       <soap:Detail>
> >>         <ns2:memberIdInfoType
> >> xmlns:ns2="http://service.webservice.acme.com/";>
> >>           <emailAddress
> >> xmlns="">[EMAIL PROTECTED]</emailAddress> <lastName
> >> xmlns="">myLastName</lastName>
> >>           <firstName xmlns="">myFirstName3</firstName>
> >>         </ns2:memberIdInfoType>
> >>       </soap:Detail>
> >>     </soap:Fault>
> >>   </soap:Body>
> >> </soap:Envelope>
> >> --------------------------------------
> >>
> >> Below are the key parts of the WSDL (I can send the whole thing if
> >> necessary).
> >>
> >> Thanks in advance - Richard
> >>
> >> <?xml version="1.0" encoding="UTF-8"?>
> >> <wsdl:definitions name="MemberServiceService"
> >>   targetNamespace="http://service.webservice.acme.com/";
> >>   xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/";
> >>   xmlns:ns1="http://service.webservice.acme.com/";
> >>   xmlns:tns="http://types.webservice.firedrum.com/";
> >>   xmlns:xsd="http://www.w3.org/2001/XMLSchema";
> >>   xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";>
> >>   <wsdl:types>
> >>     <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
> >>       xmlns:tns="http://types.webservice.acme.com/";
> >>       attributeFormDefault="unqualified"
> >> elementFormDefault="unqualified"
> >>       targetNamespace="http://types.webservice.acme.com/";>
> >>  ...
> >>       <xs:element name="MemberIdInfo"
> >>         type="tns:MemberIdInfoType">
> >>       </xs:element>
> >>       <xs:complexType name="MemberIdInfoType">
> >>         <xs:sequence>
> >>           <xs:element name="emailAddress"
> >> type="xs:string"></xs:element>
> >>           <xs:element name="lastName"
> >> type="xs:string"></xs:element> <xs:element name="firstName"
> >> type="xs:string"></xs:element> </xs:sequence>
> >>       </xs:complexType>
> >>         </xs:schema>
> >>   </wsdl:types>
> >>
> >>  ...
> >>   <wsdl:message name="MemberExistsFault">
> >>    <wsdl:part name="MemberIdInfo" element="tns:MemberIdInfo">
> >>     </wsdl:part>
> >>   </wsdl:message>
> >>
> >>  ...
> >>  <wsdl:portType name="MemberService">
> >>
> >>    <wsdl:operation name="addMember">
> >>      <wsdl:input name="addMember" message="ns1:addMember">
> >>      </wsdl:input>
> >>      <wsdl:output name="addMemberResponse"
> >>        message="ns1:addMemberResponse">
> >>      </wsdl:output>
> >>      <wsdl:fault name="InvalidClientFault"
> >>        message="ns1:InvalidClientFault">
> >>      </wsdl:fault>
> >>      <wsdl:fault name="MemberExistsFault"
> >>        message="ns1:MemberExistsFault">
> >>      </wsdl:fault>
> >>      <wsdl:fault name="InvalidEmailAddressFault"
> >>        message="ns1:InvalidEmailAddressFault">
> >>      </wsdl:fault>
> >>      <wsdl:fault name="CategoryNotFoundFault"
> >>        message="ns1:CategoryNotFoundFault">
> >>      </wsdl:fault>
> >>      <wsdl:fault name="CustomFieldTypeNotFoundFault"
> >>        message="ns1:CustomFieldTypeNotFoundFault">
> >>      </wsdl:fault>
> >>          <wsdl:fault name="AddMemberUnknownFault"
> >> message="ns1:AddMemberUnknownFault"></wsdl:fault>
> >>      </wsdl:operation>
> >>   </wsdl:portType>
> >>   <wsdl:binding name="MemberServiceServiceSoapBinding"
> >>
> >> type="ns1:MemberService">
> >>   <soap12:binding style="document"
> >>
> >> transport="http://www.w3.org/2003/05/soap/bindings/HTTP/"; />
> >>
> >>
> >>     <wsdl:operation name="addMember">
> >>       <soap12:operation soapAction="" style="document" />
> >>       <wsdl:input name="addMember">
> >>         <soap12:body use="literal" />
> >>       </wsdl:input>
> >>       <wsdl:output name="addMemberResponse">
> >>         <soap12:body use="literal" />
> >>       </wsdl:output>
> >>       <wsdl:fault name="InvalidClientFault"/>
> >>       <wsdl:fault name="MemberExistsFault"/>
> >>       <wsdl:fault name="InvalidEmailAddressFault"/>
> >>       <wsdl:fault name="CategoryNotFoundFault"/>
> >>       <wsdl:fault name="CustomFieldTypeNotFoundFault"/>
> >>             <wsdl:fault name="AddMemberUnknownFault"/>
> >>     </wsdl:operation>
> >>     <wsdl:service name="MemberServiceService">
> >>       <wsdl:port name="MemberServicePort"
> >>
> >> binding="ns1:MemberServiceServiceSoapBinding">
> >>       <soap12:address
> >> location="http://localhost:8080/services/MemberService"; />
> >>      </wsdl:port>
> >>    </wsdl:service>
> >> </wsdl:definitions>
> >
> > ----------------------------
> > IONA Technologies PLC (registered in Ireland)
> > Registered Number: 171387
> > Registered Address: The IONA Building, Shelbourne Road, Dublin 4,
> > Ireland



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
[EMAIL PROTECTED]
http://www.dankulp.com/blog

Reply via email to