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
> 


Reply via email to