Example usage for javax.xml.soap Detail getOwnerDocument

List of usage examples for javax.xml.soap Detail getOwnerDocument

Introduction

In this page you can find the example usage for javax.xml.soap Detail getOwnerDocument.

Prototype

public Document getOwnerDocument();

Source Link

Document

The Document object associated with this node.

Usage

From source file:edu.duke.cabig.c3pr.webservice.studyimportexport.impl.StudyImportExportImpl.java

/**
 * Creates the soap fault.//  w  w w.  j  ava2  s  .c  o m
 *
 * @param msg the msg
 * @return the sOAP fault
 */
private SOAPFault createSOAPFault(String msg) {
    try {
        SOAPFactory factory = SOAPFactory.newInstance();
        SOAPFault fault = factory.createFault();
        fault.setFaultString(msg);
        fault.setFaultCode(new QName(SOAP_NS, SOAP_FAULT_CODE));
        Detail detail = fault.addDetail();
        final Element detailEntry = detail.getOwnerDocument().createElementNS(SERVICE_NS, STUDY_IMPORT_FAULT);
        detail.appendChild(detailEntry);

        final Element detailMsg = detail.getOwnerDocument().createElementNS(SERVICE_NS, FAULT_MESSAGE);
        detailMsg.setTextContent(msg);
        detailEntry.appendChild(detailMsg);
        return fault;
    } catch (SOAPException e) {
        log.error(ExceptionUtils.getFullStackTrace(e));
        throw new WebServiceException(e);
    }

}