Java SOAP Message isSOAPFault(SOAPMessage messageSOAP)

Here you can find the source of isSOAPFault(SOAPMessage messageSOAP)

Description

Indicates if a SOAP message is actually a SOAP fault

License

Open Source License

Parameter

Parameter Description
messageSOAP The SOAP message

Return

true if the SOAP message is a SOAP fault

Declaration

public static boolean isSOAPFault(SOAPMessage messageSOAP) 

Method Source Code

//package com.java2s;
/*/* w ww.  j a  v  a  2 s .  c om*/
 * Copyright 2016 Mentor Graphics Corporation. All Rights Reserved.
 * <p>
 * Recipients who obtain this code directly from Mentor Graphics use it solely
 * for internal purposes to serve as example Java web services.
 * This code may not be used in a commercial distribution. Recipients may
 * duplicate the code provided that all notices are fully reproduced with
 * and remain in the code. No part of this code may be modified, reproduced,
 * translated, used, distributed, disclosed or provided to third parties
 * without the prior written consent of Mentor Graphics, except as expressly
 * authorized above.
 * <p>
 * THE CODE IS MADE AVAILABLE "AS IS" WITHOUT WARRANTY OR SUPPORT OF ANY KIND.
 * MENTOR GRAPHICS OFFERS NO EXPRESS OR IMPLIED WARRANTIES AND SPECIFICALLY
 * DISCLAIMS ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
 * OR WARRANTY OF NON-INFRINGEMENT. IN NO EVENT SHALL MENTOR GRAPHICS OR ITS
 * LICENSORS BE LIABLE FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING LOST PROFITS OR SAVINGS) WHETHER BASED ON CONTRACT, TORT
 * OR ANY OTHER LEGAL THEORY, EVEN IF MENTOR GRAPHICS OR ITS LICENSORS HAVE BEEN
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
 * <p>
 */

import javax.xml.soap.SOAPMessage;
import javax.xml.soap.SOAPException;

public class Main {
    /**
     * Indicates if a SOAP message is actually a SOAP fault
     * @param messageSOAP The SOAP message
     * @return true if the SOAP message is a SOAP fault
     */
    public static boolean isSOAPFault(SOAPMessage messageSOAP) {
        try {
            if (messageSOAP == null || messageSOAP.getSOAPBody().hasFault()) {
                return true;
            }
        } catch (SOAPException ignore) {
        }
        return false;
    }
}

Related

  1. isFaultMessage(final SOAPMessage msg)
  2. isFaultResponse(SOAPMessage message)
  3. isOutgoingMessage(SOAPMessageContext smc)
  4. isSOAP12(SOAPMessage soapMessage)
  5. isSOAP12(SOAPMessage soapMessage)
  6. printMessage(SOAPMessageContext smc)
  7. printSoapFaultException(SOAPFaultException sfe)
  8. printSOAPMessage(SOAPMessage msg, String titol)
  9. printTree(NodeList childNodes, String padding, ByteArrayOutputStream byteArrayOS)