Methods Summary |
---|
public javax.xml.soap.Detail | addDetail()Creates a Detail object and sets it as the
Detail object for this SOAPFaultException
object.
It is illegal to add a detail when the fault already
contains a detail. Therefore, this method should be called
only after the existing detail has been removed.
if(getDetail() != null){
throw new SOAPException(Messages.getMessage("valuePresent"));
}
Detail detail = convertToDetail(fault);
addChildElement(detail);
return detail;
|
private Detail | convertToDetail(org.apache.axis.AxisFault fault)Convert the details in an AxisFault to a Detail object
detail = new Detail();
Element[] darray = fault.getFaultDetails();
fault.setFaultDetail(new Element[]{});
for (int i = 0; i < darray.length; i++)
{
Element detailtEntryElem = darray[i];
DetailEntry detailEntry = detail.addDetailEntry(
new PrefixedQName(detailtEntryElem.getNamespaceURI(),
detailtEntryElem.getLocalName(), detailtEntryElem.getPrefix()));
copyChildren(detailEntry, detailtEntryElem);
}
return detail;
|
private static void | copyChildren(javax.xml.soap.SOAPElement soapElement, org.w3c.dom.Element domElement)Copy the children of a DOM element to a SOAPElement.
org.w3c.dom.NodeList nl = domElement.getChildNodes();
for (int j = 0; j < nl.getLength(); j++)
{
org.w3c.dom.Node childNode = nl.item(j);
if (childNode.getNodeType() == Node.TEXT_NODE)
{
soapElement.addTextNode(childNode.getNodeValue());
break; // only one text node assmed
}
if (childNode.getNodeType() == Node.ELEMENT_NODE)
{
String uri = childNode.getNamespaceURI();
SOAPElement childSoapElement = null;
if (uri == null)
{
childSoapElement = soapElement.addChildElement(childNode.getLocalName
());
}
else
{
childSoapElement = soapElement.addChildElement(
childNode.getLocalName(),
childNode.getPrefix(), uri);
}
copyChildren(childSoapElement, (Element) childNode);
}
}
|
public javax.xml.soap.Detail | getDetail()Returns the detail element for this SOAPFaultException
object.
A Detail object carries
application-specific error information related to
SOAPBodyElement objects.
List children = this.getChildren();
if(children==null || children.size()<=0)
return null;
// find detail element
for (int i=0; i < children.size(); i++) {
Object obj = children.get(i);
if (obj instanceof javax.xml.soap.Detail) {
return (javax.xml.soap.Detail) obj;
}
}
return null;
|
public org.apache.axis.AxisFault | getFault()
return fault;
|
public java.lang.String | getFaultActor()Gets the fault actor for this SOAPFaultException
object.
return fault.getFaultActor();
|
public java.lang.String | getFaultCode()Gets the fault code for this SOAPFaultException
object.
return fault.getFaultCode().getLocalPart();
|
public javax.xml.soap.Name | getFaultCodeAsName()
QName qname = fault.getFaultCode();
String uri = qname.getNamespaceURI();
String local = qname.getLocalPart();
return new PrefixedQName(uri, local, prefix);
|
private javax.xml.namespace.QName | getFaultQName(java.lang.Class cls, org.apache.axis.encoding.SerializationContext context)
QName qname = null;
if (! cls.equals(AxisFault.class)) {
FaultDesc faultDesc = null;
if (context.getMessageContext() != null) {
OperationDesc op = context.getMessageContext().getOperation();
if (op != null) {
faultDesc = op.getFaultByClass(cls);
}
}
if (faultDesc != null) {
qname = faultDesc.getQName();
}
}
return qname;
|
public java.lang.String | getFaultString()Gets the fault string for this SOAPFaultException
object.
return fault.getFaultString();
|
public java.util.Locale | getFaultStringLocale()
return locale;
|
public void | outputImpl(org.apache.axis.encoding.SerializationContext context)
SOAPConstants soapConstants = context.getMessageContext() == null ?
SOAPConstants.SOAP11_CONSTANTS :
context.getMessageContext().getSOAPConstants();
namespaceURI = soapConstants.getEnvelopeURI();
name = Constants.ELEM_FAULT;
context.registerPrefixForURI(prefix, soapConstants.getEnvelopeURI());
context.startElement(new QName(this.getNamespaceURI(),
this.getName()),
attributes);
// XXX - Can fault be anything but an AxisFault here?
if (fault instanceof AxisFault) {
AxisFault axisFault = fault;
if (axisFault.getFaultCode() != null) {
// Do this BEFORE starting the element, so the prefix gets
// registered if needed.
if (soapConstants == SOAPConstants.SOAP12_CONSTANTS) {
String faultCode = context.qName2String(axisFault.getFaultCode());
context.startElement(Constants.QNAME_FAULTCODE_SOAP12, null);
context.startElement(Constants.QNAME_FAULTVALUE_SOAP12, null);
context.writeSafeString(faultCode);
context.endElement();
QName[] subcodes = axisFault.getFaultSubCodes();
if (subcodes != null) {
for (int i = 0; i < subcodes.length; i++) {
faultCode = context.qName2String(subcodes[i]);
context.startElement(Constants.QNAME_FAULTSUBCODE_SOAP12, null);
context.startElement(Constants.QNAME_FAULTVALUE_SOAP12, null);
context.writeSafeString(faultCode);
context.endElement();
}
for (int i = 0; i < subcodes.length; i++)
context.endElement();
}
context.endElement();
} else {
String faultCode = context.qName2String(axisFault.getFaultCode());
context.startElement(Constants.QNAME_FAULTCODE, null);
context.writeSafeString(faultCode);
context.endElement();
}
}
if (axisFault.getFaultString() != null) {
if (soapConstants == SOAPConstants.SOAP12_CONSTANTS) {
context.startElement(Constants.QNAME_FAULTREASON_SOAP12, null);
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("http://www.w3.org/XML/1998/namespace", "lang", "xml:lang", "CDATA", "en");
context.startElement(Constants.QNAME_TEXT_SOAP12, attrs);
} else
context.startElement(Constants.QNAME_FAULTSTRING, null);
context.writeSafeString(axisFault.getFaultString());
context.endElement();
if (soapConstants == SOAPConstants.SOAP12_CONSTANTS) {
context.endElement();
}
}
if (axisFault.getFaultActor() != null) {
if (soapConstants == SOAPConstants.SOAP12_CONSTANTS)
context.startElement(Constants.QNAME_FAULTROLE_SOAP12, null);
else
context.startElement(Constants.QNAME_FAULTACTOR, null);
context.writeSafeString(axisFault.getFaultActor());
context.endElement();
}
if (axisFault.getFaultNode() != null) {
if (soapConstants == SOAPConstants.SOAP12_CONSTANTS) {
context.startElement(Constants.QNAME_FAULTNODE_SOAP12, null);
context.writeSafeString(axisFault.getFaultNode());
context.endElement();
}
}
// get the QName for this faults detail element
QName qname = getFaultQName(fault.getClass(), context);
if (qname == null && fault.detail != null) {
qname = getFaultQName(fault.detail.getClass(), context);
}
if (qname == null) {
// not the greatest, but...
qname = new QName("", "faultData");
}
Element[] faultDetails = axisFault.getFaultDetails();
if (faultDetails != null) {
if (soapConstants == SOAPConstants.SOAP12_CONSTANTS)
context.startElement(Constants.QNAME_FAULTDETAIL_SOAP12, null);
else
context.startElement(Constants.QNAME_FAULTDETAILS, null);
// Allow the fault to write its data, if any
axisFault.writeDetails(qname, context);
// Then output any other elements
for (int i = 0; i < faultDetails.length; i++) {
context.writeDOMElement(faultDetails[i]);
}
if (detail!= null) {
for (Iterator it = detail.getChildren().iterator(); it.hasNext();) {
((NodeImpl)it.next()).output(context);
}
}
context.endElement();
}
}
context.endElement();
|
public void | setFault(org.apache.axis.AxisFault fault)
this.fault = fault;
|
public void | setFaultActor(java.lang.String faultActor)Sets this SOAPFaultException object with the given
fault actor.
The fault actor is the recipient in the message path who
caused the fault to happen.
fault.setFaultActor(faultActor);
|
public void | setFaultCode(javax.xml.soap.Name faultCodeQName)
String uri = faultCodeQName.getURI();
String local = faultCodeQName.getLocalName();
String prefix = faultCodeQName.getPrefix();
this.prefix = prefix;
QName qname = new QName(uri,local);
fault.setFaultCode(qname);
|
public void | setFaultCode(java.lang.String faultCode)Sets this SOAPFaultException object with the given
fault code.
Fault codes, which given information about the fault,
are defined in the SOAP 1.1 specification.
fault.setFaultCodeAsString(faultCode);
|
public void | setFaultString(java.lang.String faultString)Sets the fault string for this SOAPFaultException
object to the given string.
fault.setFaultString(faultString);
|
public void | setFaultString(java.lang.String faultString, java.util.Locale locale)
fault.setFaultString(faultString);
this.locale = locale;
|