axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jarek Gawor" <ga...@mcs.anl.gov>
Subject RE: WS-I testing: warnings about faultcode
Date Fri, 03 Sep 2004 05:06:07 GMT
> -----Original Message-----
> From: Ias [mailto:iasandcb@hotmail.com] 
> Sent: Monday, August 30, 2004 6:27 PM
> To: axis-dev@ws.apache.org
> Subject: RE: WS-I testing: warnings about faultcode
> 
> 
> > I was running the WS-I BP validation tools against the wire
> > messages produced by Axis on our software. Two assertion 
> > warnings related to faultcode were raised:
> > 
> > WSI1031: A soap:Fault element makes use of the SOAP 1.1 dot 
> notation.
> > 
> > WSI1302: The soap:faultcode value in the soap:Fault element
> > of the response message is not one of: VersionMismatch, 
> > MustUnderstand, Client, Server, or is not qualified by a namespace.
> > 
> > The faultcode of the fault was (which is generated by default
> > by Axis):
> > 
> > <faultcode>soapenv:Server.generalException</faultcode>
> > 
> > I'm wondering what people think about fixing this in Axis
> > since it is a minor issue and it does not cause the 
> > validation to fail. 
> 
> Thanks for raising up the issue. Here's my ideas on it:
> 
> The one approach is changing 
> 
>     public static final String FAULT_SERVER_GENERAL =
>  
> "Server.generalException";
> 
>     public static final String FAULT_SERVER_USER =
>                                                    
> "Server.userException";
> 
> in Constants to
> 
>     public static final String FAULT_SERVER_GENERAL =
>                                                    "Server";
> 
>     public static final String FAULT_SERVER_USER =
>                                                    "Server";
> 
> i.e. making no difference between general exceptions and user 
> exceptions. This approach is fairly simple :-)
> 
> The other approach is related to AxisFault's 
> setFaultCodeAsString, which simply makes the namespace of a 
> give fault code the URI of the SOAP envelope containing the 
> fault. First, we need to change those constants above to
> 
>     public static final String FAULT_SERVER_GENERAL =
>                                                    
> "ServerGeneralException";
> 
>     public static final String FAULT_SERVER_USER =
>                                                    
> "ServerUserException";
> 
> 
> , then change
> 
>     public void setFaultCodeAsString(String code) {
>         SOAPConstants soapConstants = 
> MessageContext.getCurrentContext() == null ?
>                                         
> SOAPConstants.SOAP11_CONSTANTS :
>  
> MessageContext.getCurrentContext().getSOAPConstants();
> 
>         faultCode = new QName(soapConstants.getEnvelopeURI(), code);
>     }
> 
> to
> 
>     public void setFaultCodeAsString(String code) {
>         SOAPConstants soapConstants = 
> MessageContext.getCurrentContext() == null ?
>                                         
> SOAPConstants.SOAP11_CONSTANTS :
>  
> MessageContext.getCurrentContext().getSOAPConstants();
> 
>         if (code.equals("VersionMismatch") ||
>            code.equals("MustUnderstand") ||
>            code.equals("Client") ||
>            code.equals("Server")) {	
> 	faultCode = new QName(soapConstants.getEnvelopeURI(), code);
>         } else {
> 	faultCode = new QName(Constants.NS_URI_AXIS, code);
>         }  
> 
> I think adopting both ideas could be better for clear and 
> safe server fault codes.

I like the combination of two. I would suggest changing the
FAULT_SERVER_GENERAL to "Server" and FAULT_SERVER_USER to
"ServerUserException" and adopting the suggested setFaultCodeAsString()
method. 
I'll go ahead and make the changes if there are no objections to these
modifications.

Jarek




Mime
View raw message