You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Richard Mixon (JIRA)" <ji...@apache.org> on 2007/10/11 01:08:50 UTC
[jira] Commented: (CXF-1028) Fault is being returned as general
SOAPFaultException instead of specific fault
[ https://issues.apache.org/jira/browse/CXF-1028?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12533898 ]
Richard Mixon commented on CXF-1028:
------------------------------------
I finally did verify - and with both the cxf 2.1 snapshot and with cxf 2.0.2 this now works, throwing the correct exception types.
Thank you!
> Fault is being returned as general SOAPFaultException instead of specific fault
> -------------------------------------------------------------------------------
>
> Key: CXF-1028
> URL: https://issues.apache.org/jira/browse/CXF-1028
> Project: CXF
> Issue Type: Bug
> Affects Versions: 2.0.1, 2.1
> Environment: Mac OS X 10.4.10
> Reporter: Richard Mixon
> Assignee: Daniel Kulp
> Fix For: 2.0.2
>
> Attachments: acmeSTP.jar
>
>
> I posted on the cxf-user list - my WSDL and the SOAP log. On the surface things looked like they should be working. both Daniel Kulp and Jervis Liu responded.
> Jervis Liu suggested I zip up my code and post it as a JIRA incident so it could be better looked at.
> I have zipped up a simplified version of my code that still shows the wrong exception being caught. I did ommit the jar files (commons-logging, cxf, etc) to reduce space - so the zip is very small ~ 115KB.
> I have dummied things out - no database access or anything.
> My original post is titled "Not able to catch desired Fault type" and was posted at 8:15MST on September 12.
> Below is the text of the original post. I will attach my code (as I mentioned above).
> Thank you - Richard Mixon
> ------ Forwarded Message
> From: Richard Mixon <rn...@qwest.net>
> Date: Wed, 12 Sep 2007 20:15:46 -0700
> To: <cx...@incubator.apache.org>
> Conversation: Not able to catch desired Fault type
> 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="">myEmail3@myDomain.com</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>
> ------ End of Forwarded Message
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.