axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davanum Srinivas <d...@yahoo.com>
Subject Re: soap 1.2 axisfault patch
Date Thu, 14 Nov 2002 12:42:07 GMT
Andras,

Please post these to bugzilla (http://nagoya.apache.org/bugzilla).

Thanks,
dims

--- Andras.Avar@nokia.com wrote:
> Hi,
> 
> I have attached some patches about the SOAP 1.2 compliance of FAULT (also serializers
and
> deserialziers). Please check them and let me know if you have any suggestions.
> 
> Br,
> Andras
> 
> *******************************************************************
> --- 1_0/org/apache/axis/AxisFault.java	Tue Sep 17 22:38:10 2002
> +++ mysoap12/org/apache/axis/AxisFault.java	Thu Nov 14 10:51:17 2002
> @@ -90,9 +90,11 @@
>          LogFactory.getLog(AxisFault.class.getName());
>  
>      protected QName     faultCode ;
> +    protected Vector    faultSubCode ;
>      protected String    faultString = "";
>      protected String    faultActor ;
>      protected Vector    faultDetails ;  // vector of Element's
> +    protected String    faultNode ;
>  
>      /** SOAP headers which should be serialized with the Fault */
>      protected ArrayList faultHeaders = null;
> @@ -103,7 +105,7 @@
>       * AxisFault.  If the Exception is an InvocationTargetException (which
>       * already wraps another Exception), get the wrapped Exception out from
>       * there and use that instead of the passed one.
> -     */ 
> +     */
>      public static AxisFault makeFault(Exception e)
>      {
>          if (e instanceof InvocationTargetException) {
> @@ -112,14 +114,17 @@
>                  e = (Exception)t;
>              }
>          }
> -        
> +
>          if (e instanceof AxisFault) {
>              return (AxisFault)e;
>          }
> -        
> +
>          return new AxisFault(e);
>      }
> -    
> +
> +    /**
> +     * @deprecated
> +     */
>      public AxisFault(String code, String str,
>                       String actor, Element[] details) {
>          super (str);
> @@ -131,6 +136,9 @@
>              initFromException(this);
>      }
>  
> +    /**
> +     * @deprecated
> +     */
>      public AxisFault(QName code, String str,
>                       String actor, Element[] details) {
>          super (str);
> @@ -142,21 +150,36 @@
>              initFromException(this);
>      }
>  
> +    public AxisFault(QName code, QName[] subcodes, String str,
> +                     String actor, String node, Element[] details) {
> +        super (str);
> +        setFaultCode( code );
> +        if (subcodes != null)
> +            for (int i = 0; i < subcodes.length; i++)
> +                addFaultSubCode( subcodes[i] );
> +        setFaultString( str );
> +        setFaultActor( actor );
> +        setFaultNode( node );
> +        setFaultDetail( details );
> +        if (details == null)
> +            initFromException(this);
> +    }
> +
>      /**
>       * Wrap an AxisFault around an existing Exception - this is private
>       * to force everyone to use makeFault() above, which sanity-checks us.
> -     */ 
> +     */
>      protected AxisFault(Exception target) {
>          super ("", target);
> -
> +        // ? SOAP 1.2 or 1.1 ?
>          setFaultCode( Constants.FAULT_SERVER_USER );
> -        
>          initFromException(target);
>      }
>  
>      public AxisFault(String message)
>      {
>          super (message);
> +        // ? SOAP 1.2 or 1.1 ?
>          setFaultCode(Constants.FAULT_SERVER_GENERAL);
>          setFaultString(message);
>          initFromException(this);
> @@ -168,14 +191,16 @@
>      public AxisFault()
>      {
>          super();
> -        setFaultCode(Constants.FAULT_SERVER_GENERAL);     
> +        // ? SOAP 1.2 or 1.1 ?
> +        setFaultCode( Constants.FAULT_SERVER_USER );
>          initFromException(this);
>      }
>  
>      public AxisFault (String message, Throwable t)
>      {
>          super (message, t);
> -        setFaultCode(Constants.FAULT_SERVER_GENERAL);
> +        // ? SOAP 1.2 or 1.1 ?
> +        setFaultCode( Constants.FAULT_SERVER_USER );
>          setFaultString(message);
>      }
>  
> @@ -190,34 +215,34 @@
>              }
>          }
>  
> -        // Set the exception message (if any) as the fault string 
> +        // Set the exception message (if any) as the fault string
>          setFaultString( target.toString() );
> -        
> +
>          if (faultDetails == null) faultDetails = new Vector();
>  
>          Element el;
> -        
> +
>          // If we're derived from AxisFault, then put the exception class
>          // into the "exceptionName" element in the details.  This allows
>          // us to get back a correct Java Exception class on the other side
>          // (assuming they have it available).
> -        
> +
>          if ((target instanceof AxisFault) &&
>              (target.getClass() != AxisFault.class)) {
> -            el = XMLUtils.StringToElement(Constants.NS_URI_AXIS, 
> -                                                  "exceptionName", 
> +            el = XMLUtils.StringToElement(Constants.NS_URI_AXIS,
> +                                                  "exceptionName",
>                                                    target.getClass().getName());
> -            
> -            faultDetails.add(el);        
> +
> +            faultDetails.add(el);
>          }
> -        
> -        el =  XMLUtils.StringToElement(Constants.NS_URI_AXIS, 
> -                                       "stackTrace", 
> +
> +        el =  XMLUtils.StringToElement(Constants.NS_URI_AXIS,
> +                                       "stackTrace",
>                                         JavaUtils.stackToString(target));
>  
>          faultDetails.add(el);
>      }
> -    
> +
>      public void dump()
>      {
>          log.debug(dumpToString());
> @@ -235,11 +260,22 @@
>                            + XMLUtils.getInnerXMLString(e);
>              }
>          }
> -        
> +
> +        String subCodes = new String();
> +        if (faultSubCode != null) {
> +            for (int i = 0; i < faultSubCode.size(); i++) {
> +                subCodes += JavaUtils.LS
> +                            + (QName)faultSubCode.elementAt(i);
> +
> +            }
> +        }
> +
>          return "AxisFault" + JavaUtils.LS
>              + " faultCode: " + faultCode + JavaUtils.LS
> +            + " faultSubcode: " + subCodes + JavaUtils.LS
>              + " faultString: " + faultString + JavaUtils.LS
>              + " faultActor: " + faultActor + JavaUtils.LS
> +            + " faultNode: " + faultNode + JavaUtils.LS
>              + " faultDetail: " + details + JavaUtils.LS
>              ;
>      }
> @@ -249,11 +285,46 @@
>      }
>  
>      public void setFaultCode(String code) {
> -        faultCode = new QName(Constants.NS_URI_AXIS, code);
> +        faultCode = new QName(Constants.URI_SOAP12_ENV, code);
> +    }
> +
> 
=== message truncated ===

> ATTACHMENT part 2 application/octet-stream name=AxisFault.java


> ATTACHMENT part 3 application/octet-stream name=Constants.java


> ATTACHMENT part 4 application/octet-stream name=SOAPFaultBuilder.java


> ATTACHMENT part 5 application/octet-stream name=SOAPFaultCodeBuilder.java


> ATTACHMENT part 6 application/octet-stream name=SOAPFault.java



=====
Davanum Srinivas - http://xml.apache.org/~dims/

__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

Mime
View raw message