axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Soactive Inc <soact...@gmail.com>
Subject Re: Getting details from a SOAP fault
Date Wed, 31 Aug 2005 04:45:27 GMT
Hi Chris,

Try this (note - this may not compile directly - please make changes and 
use):

// first, get responseMessage

if (responseMessage.getSOAPPart().getEnvelope().getBody().hasFault()) {
SOAPFault soapFault = responseMessage.getSOAPBody().getFault();
System.out.println("Fault Name: " + soapFault.getFaultCodeAsName
().getQualifiedName());
System.out.println("Fault Actor: " + fault.setFaultActor(
soapFault.getFaultActor());
StringBuffer detailBuf = new StringBuffer();
Detail detail = soapFault.getDetail();
if (detail != null) {
Iterator it = detail.getDetailEntries();
while (it.hasNext()) {
DetailEntry entry = (DetailEntry) it.next();
String value = entry.getValue();
detailBuf.append("\n" + value);
}
}
System.out.println("Fault Detail: " + detailBuf.toString());

// rest of your code

Best Regards,
-Arun

On 8/30/05, Chris Nappin <C.Nappin@abm-uk.com> wrote:
> 
> Hi,
> 
> I'm receiving a custom SOAP fault in my client, with various 
> application-specific error data items in the fault's "details" section. When 
> using the JAX-RPC/JAXM APIs, I get a null details object:
> 
> SOAPMessage response = ..call the service using JAXM..
> 
> if (response.getSOAPBody().hasFault()) {
> Detail detail = response.getSOAPBody().getFault().getDetail();
> if (detail == null) {
> System.out.println("Detail is null!");
> } else {
> ..output the details object..
> }
> }
> 
> But when casting the SOAPFault to a "org.apache.axis.message.SOAPFault" 
> then using the Axis-specific APIs (e.g. getFault().getFaultDetails()) on 
> the same response, I do get the XML I'm expecting.
> 
> Am I doing something wrong?
> 
> thanks,
> 
> Chris Nappin
> Technical Architect
> 
> ABM United Kingdom Limited
> Telephone: +44 (0) 115 977 6999
> Facsimile: +44 (0) 115 977 6850
> Web: http://www.abm-uk.com
> 
> ABM for Intelligent Solutions
> 
> 
> 
> CONFIDENTIALITY & PRIVILEGE NOTICE
> 
> This e-mail is confidential to its intended recipient. It may also be 
> privileged. Neither the confidentiality nor any privilege attaching to this 
> e-mail is waived lost or destroyed by reason that it has been mistakenly 
> transmitted to a person or entity other than its intended recipient. If you 
> are not the intended recipient please notify us immediately by telephone or 
> fax at the numbers provided above or e-mail by Reply To Author and return 
> the printed e-mail to us by post at our expense. We believe, but do not 
> warrant, that this e-mail and any attachments are virus-free, but you should 
> check. We may monitor traffic data of both business and personal e-mails. We 
> are not liable for any opinions expressed by the sender where this is a 
> non-business e-mail. If you do not receive all the message, or if you have 
> difficulty with the transmission, please telephone us immediately.
>

Mime
View raw message