Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source
   * Copyright 2006, Red Hat Middleware LLC, and individual contributors
   * as indicated by the @author tags. 
   * See the copyright.txt in the distribution for a full listing 
   * of individual contributors.
   * This copyrighted material is made available to anyone wishing to use,
   * modify, copy, or redistribute it subject to the terms and conditions
   * of the GNU Lesser General Public License, v. 2.1.
  * This program is distributed in the hope that it will be useful, but WITHOUT A
  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
  * You should have received a copy of the GNU Lesser General Public License,
  * v.2.1 along with this distribution; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
  * 
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
 package com.arjuna.webservices;
 
 
Class representing a SOAP Fault

Author(s):
kevin
 
 public class SoapFault extends Exception
 {
    
Serial version UID for serialisation.
 
     private static final long serialVersionUID = -5256882376188382002L ;
    
    
The SOAP fault type.
 
     protected SoapFaultType soapFaultType ;
    
The SOAP fault subcode.
 
     protected QName subcode ;
    
The SOAP fault sub subcode.
 
     protected QName subSubcode ;
    
The SOAP fault reason.
 
     protected String reason ;
    
The SOAP fault reason.
 
     protected String node ;
    
The SOAP fault detail as a string.
 
     protected String detail ;
    
The SOAP fault role.
 
     protected String role ;
    
The header fault flag.
 
     protected boolean headerFault ;
    
The associated action.
 
     protected String action ;
    
    
Default constructor.
 
     protected SoapFault()
     {
     }
    
    
Construct a SOAP fault based on a throwable.

Parameters:
th The throwable.
 
     protected SoapFault(final Throwable th)
     {
         this(.nullth.toString(), generateStackTrace(th)) ;
     }
    
    
Create a custom SOAP fault.

Parameters:
soapFaultType the soap fault type.
subcode The fault subcode.
reason The fault reason.
 
     protected SoapFault(final SoapFaultType soapFaultTypefinal QName subcodefinal String reason)
    {
        this(soapFaultTypesubcodereasonnull) ;
    }
    
    
Create a custom SOAP fault.

Parameters:
soapFaultType the soap fault type.
reason The fault reason.
    protected SoapFault(final SoapFaultType soapFaultTypefinal String reason)
    {
        this(soapFaultTypenullreasonnull) ;
    }
    
    
Create a custom SOAP fault.

Parameters:
soapFaultType the soap fault type.
reason The fault reason.
detail The fault detail.
    protected SoapFault(final SoapFaultType soapFaultType,
        final String reasonfinal String detail)
    {
        this(soapFaultTypenullreasondetail) ;
    }
    
    
Create a custom SOAP fault.

Parameters:
soapFaultType the soap fault type.
subcode The fault subcode.
reason The fault reason.
detail The fault detail.
    protected SoapFault(final SoapFaultType soapFaultTypefinal QName subcode,
        final String reasonfinal String detail)
    {
        this. = soapFaultType ;
        this. = subcode ;
        this. = reason ;
        this. = detail ;
    }
    
    
Get the SOAP fault type.

Returns:
The SOAP fault type.
    {
        return  ;
    }
    
    
Set the SOAP fault type.

Parameters:
soapFaultType The SOAP fault type.
    public void setSoapFaultType(final SoapFaultType soapFaultType)
    {
        this. = soapFaultType ;
    }
    
    
Get the SOAP fault subcode.

Returns:
The SOAP fault subcode.
    public QName getSubcode()
    {
        return  ;
    }
    
    
Set the SOAP fault subcode.

Parameters:
subcode The SOAP fault subcode.
    public void setSubcode(final QName subcode)
    {
        this. = subcode ;
    }
    
    
Get the SOAP fault sub subcode.

Returns:
The SOAP fault sub subcode.
    public QName getSubSubcode()
    {
        return  ;
    }
    
    
Set the SOAP fault sub subcode.

Parameters:
subSubcode The SOAP fault sub subcode.
    public void setSubSubcode(final QName subSubcode)
    {
        this. = subSubcode ;
    }
    
    
Get the SOAP fault reason.

Returns:
The SOAP fault reason.
    public String getReason()
    {
        return  ;
    }
    
    
Set the SOAP fault reason.

Parameters:
reason The SOAP fault reason.
    public void setReason(final String reason)
    {
        this. = reason ;
    }
    
    
Get the SOAP fault node.

Returns:
The SOAP fault node.
    public String getNode()
    {
        return  ;
    }

    
Set the SOAP fault node.

Parameters:
node The SOAP fault node.
    public void setNode(final String node)
    {
        this. = node ;
    }

     
Get the SOAP fault role.

Returns:
The SOAP fault role.
    public String getRole()
    {
        return  ;
    }
    
    
Set the SOAP fault role.

Parameters:
role The SOAP fault role.
    public void setRole(final String role)
    {
        this. = role ;
    }
    
    
Get the SOAP fault detail.

Returns:
The SOAP fault detail.
    public String getDetail()
    {
        return  ;
    }
    
    
Set the SOAP fault detail.

Parameters:
detail The SOAP fault detail.
    public void setDetail(final String detail)
    {
        this. = detail ;
    }
    
    
Is this a fault from a SOAP header?

Returns:
true if generated by a SOAP header, false otherwise.
    public boolean isHeaderFault()
    {
        return  ;
    }

    
Set the header fault flag.

Parameters:
headerFault true if generated by a SOAP header, false otherwise.
    public void setHeaderFault(final boolean headerFault)
    {
        this. = headerFault ;
    }
    
    
Get the fault action.

Returns:
The fault action.
    public String getAction()
    {
        return  ;
    }
    
    
Set the fault action.

Parameters:
action The fault action.
    public void setAction(final String action)
    {
        this. = action ;
    }
    
    
Get a message describing this fault.

Returns:
The fault message.
    public String getMessage()
    {
        final StringBuffer buffer = new StringBuffer(.getValue()) ;
        if ( != null)
        {
            buffer.append('[') ;
            buffer.append() ;
            if ( != null)
            {
                buffer.append(':') ;
                buffer.append() ;
            }
            buffer.append(']') ;
        }
        if ( != null)
        {
            buffer.append('[') ;
            buffer.append() ;
            buffer.append(']') ;
        }
        if ( != null)
        {
            buffer.append('[') ;
            buffer.append() ;
            buffer.append(']') ;
        }
        return buffer.toString() ;
    }
    
    
Generate a stack trace from a throwable.

Parameters:
th The throwable.
Returns:
The stack trace.
    public static String generateStackTrace(final Throwable th)
    {
        final StringWriter writer = new StringWriter() ;
        final PrintWriter pw = new PrintWriter(writer) ;
        th.printStackTrace(pw) ;
        if (!pw.checkError())
        {
            pw.close() ;
            return writer.toString() ;
        }
        else
        {
            return null ;
        }
    }
New to GrepCode? Check out our FAQ X