I did not figure how we can throw your own fault type, which seems possible from what I am reading here, however, you can get access to all of the content of the faultDetail.
Here is some sample code... Element[] detail = e.getFaultDetails(); for (int i=0; i<detail.length; i++) System.out.println( documentToString(detail[i].getOwnerDocument())); static String documentToString(Document doc) throws Exception { OutputFormat format = new OutputFormat( doc ); StringWriter stringOut = new StringWriter(); XMLSerializer serial = new XMLSerializer( stringOut, format ); serial.asDOMSerializer(); serial.serialize( doc.getDocumentElement() ); return stringOut.toString(); } Sylvain. -----Original Message----- From: Schwartz, Brenton [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 30, 2002 11:52 AM To: '[EMAIL PROTECTED]' Subject: RE: AxisFault vs SOAP Fault In case this question got lost inside a previous post I am re-asking it here: I realy need to get at a custom fault code. This does not appear to possible through the API due to a disconnect between SOAPFault and AxisFault. Does anyone know a way to get at the raw SOAP message returned from the commmunication. If so, I can use DOM to get at the value or in the worst case I can use a regular expression to yank the value out of the string. -----Original Message----- From: Schwartz, Brenton [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 30, 2002 9:12 AM To: '[EMAIL PROTECTED]' Subject: RE: AxisFault vs SOAP Fault Axis.GetFaultDetails returns an array of Elements Cycling on these elements all I get is a stack trace in element[0] and nothing else. I suspect that this is because Axis threw an exception when trying to read the details and put the stack trace in that slot for safe keeping... Next way to attempt a solution: Does anyone know a way to get at the raw SOAP message returned from the commmunication. If I can use DOM to get at the value or in the worst case I can use a regular expression to yank the value out of the string. Thanks Brent I can either use or -----Original Message----- From: R J Scheuerle Jr [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 29, 2002 5:37 PM To: [EMAIL PROTECTED] Subject: RE: AxisFault vs SOAP Fault This may be related to the fact that axis does not adequately serializer/deserialize the contents of the fault. Did you try Axis.getFaultDetails ? Rich Scheuerle XML & Web Services Development 512-838-5115 (IBM TL 678-5115) "Schwartz, Brenton" <[EMAIL PROTECTED]> 05/29/2002 05:23 PM Please respond to axis-user To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> cc: Subject: RE: AxisFault vs SOAP Fault Thanks for the try, System.out.println(AxisFault.getFaultCode() ); prints the value "Server" which is the <soap-env:faultcode>Server </soap-env:faultcode> out of the soap message not the message several layers down which contains the actual <e:errorCode>4500</e:errorCode> that I need access to. I found an archived message from Subject: mapping javax.xml.soap.SOAPFault to AxisFault From: "Chris Haddad" <[EMAIL PROTECTED]> Date: 2002-03-27 18:01:13 that implies that this is a deeper problem... Brent -----Original Message----- From: R J Scheuerle Jr [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 29, 2002 5:07 PM To: [EMAIL PROTECTED] Subject: Re: AxisFault vs SOAP Fault The fault "contents" currently are not passed across the wire. Use AxisFault.getFaultCode() to get the fault code. Hope this helps. Rich Scheuerle XML & Web Services Development 512-838-5115 (IBM TL 678-5115) "Schwartz, Brenton" <[EMAIL PROTECTED]> 05/29/2002 05:03 PM Please respond to axis-user To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> cc: Subject: AxisFault vs SOAP Fault I am having trouble getting the fault code out of a SOAP message Environment: ------------------------------- SunOS zima 5.8 Generic_111433-02 sun4u sparc SUNW,Sun-Blade-1000 java version "1.4.0" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92) Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode) axis Beta2, Nightly Release 28 May 02 The value I want to access: --------------------------------- <e:errorCode>4500</e:errorCode> Soap Message Returned: --------------------------------- <soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"> <soap-env:Header> <qxg:TASK_ID xmlns:qxg="http://www.qwest.com/qxg/">KG0UW67N.19SSDJ0.UXFLKZ</qxg:TASK_ID> </soap-env:Header> <soap-env:Body> <soap-env:Fault> <soap-env:faultactor>http://www.qwest.com/qxg/jmsqueue/DefaultBusinessLogicQ ueue/BAAGetOrderStatusResultActor </soap-env:faultactor> <soap-env:faultcode>Server </soap-env:faultcode> <soap-env:faultstring>Rejected - Order does not exist </soap-env:faultstring> <soap-env:Detail> <e:faultDetails xmlns:e="http://www.qwest.com/qxg/"> <e:message>Rejected - Order does not exist </e:message> <e:errorCode>4500 </e:errorCode> </e:faultDetails> </soap-env:Detail> </soap-env:Fault> </soap-env:Body> </soap-env:Envelope> Code Fragment where I am trying to access the data: --------------------------------------- catch (org.apache.axis.AxisFault e) { System.out.println(e.dumpToString()); // I want to be able to access the value // here so I can do processing on it. } What I get from the Dump: ---------------------------------------------------- AxisFault faultCode: Server faultString: Rejected - Order does not exist faultActor: http://www.qwest.com/qxg/jmsqueue/DefaultBusinessLogicQueue/BAAGetOrderStatu sResultActor This message may contain privileged and/or confidential information. If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so. Thank you.