Example usage for javax.xml.soap DetailEntry addTextNode

List of usage examples for javax.xml.soap DetailEntry addTextNode

Introduction

In this page you can find the example usage for javax.xml.soap DetailEntry addTextNode.

Prototype

public SOAPElement addTextNode(String text) throws SOAPException;

Source Link

Document

Creates a new Text object initialized with the given String and adds it to this SOAPElement object.

Usage

From source file:net.bpelunit.framework.control.util.BPELUnitUtil.java

/**
 * Creates a new, generic SOAP fault to be used when something goes wrong in a partner track and
 * other tracks must be notified.//from  w  ww .ja  v a 2  s . c o m
 * 
 * @return
 */
public static SOAPMessage generateGenericSOAPFault() {

    try {
        MessageFactory mFactory = MessageFactory.newInstance();
        SOAPMessage message = mFactory.createMessage();
        SOAPBody body = message.getSOAPBody();
        SOAPFault fault = body.addFault(BPELUnitConstants.SOAP_FAULT_CODE_CLIENT,
                BPELUnitConstants.SOAP_FAULT_DESCRIPTION);

        Detail detail = fault.addDetail();
        DetailEntry entry = detail
                .addDetailEntry(new QName("http://www.bpelunit.org/framework/error", "BPELUnitFault"));
        entry.addTextNode(
                "The BPELUnit test framework has detected a test failure or error. This test case is aborted.");

        return message;

    } catch (Exception e) {
        return null;
    }
}