cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glen Mazza <glen.ma...@verizon.net>
Subject Re: svn commit: r573017 [1/2] - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/interceptor/ api/src/main/java/org/apache/cxf/phase/ common/common/src/main/java/org/apache/cxf/common/commands/ common/common/src/main/java/org/apache/cxf/common/log...
Date Wed, 05 Sep 2007 18:53:25 GMT
Am Mittwoch, den 05.09.2007, 18:13 +0000 schrieb dkulp@apache.org:
> Author: dkulp
> Date: Wed Sep  5 11:12:51 2007
> New Revision: 573017
> 
> Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/Fault.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/Fault.java?rev=573017&r1=573016&r2=573017&view=diff
> ==============================================================================
> --- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/Fault.java (original)
> +++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/Fault.java Wed Sep
 5 11:12:51 2007
> @@ -131,9 +131,11 @@
>      }
>  
>      public Element getOrCreateDetail() {
> -        Document d = DOMUtils.createDocument();
> -        Element element = d.createElement("Fault");
> -        this.detail = element;
> -        return element;
> +        if (detail == null) {
> +            Document d = DOMUtils.createDocument();
> +            Element element = d.createElement("Fault");
> +            this.detail = element;

Perhaps the "element" variable can be removed here.

> +        }
> +        return detail;
>      }
>  }
>

> Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java?rev=573017&r1=573016&r2=573017&view=diff
> ==============================================================================
> --- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java
(original)
> +++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java
Wed Sep  5 11:12:51 2007
> @@ -26,9 +26,12 @@
>  
>  import javax.xml.ws.handler.MessageContext;
>  import javax.xml.ws.handler.MessageContext.Scope;
> +import javax.xml.ws.soap.SOAPFaultException;
>  
> +import org.apache.cxf.binding.soap.SoapFault;
>  import org.apache.cxf.common.util.factory.Factory;
>  import org.apache.cxf.helpers.CastUtils;
> +import org.apache.cxf.interceptor.Fault;
>  import org.apache.cxf.jaxws.context.WebServiceContextImpl;
>  import org.apache.cxf.jaxws.context.WrappedMessageContext;
>  import org.apache.cxf.jaxws.support.ContextPropertiesMapping;
> @@ -58,6 +61,21 @@
>          super(factory, scope);
>      }
>  
> +    protected Fault createFault(Throwable ex) {
> +        //map the JAX-WS faults
> +        if (ex instanceof SOAPFaultException) {
> +            SOAPFaultException sfe = (SOAPFaultException)ex;
> +            SoapFault fault = new SoapFault(sfe.getFault().getFaultString(),
> +                                            sfe,
> +                                            sfe.getFault().getFaultCodeAsQName());

This seems suboptimal, given that SoapFault already works with a
SOAPFaultException (2nd argument), it should be able to derive the first
and third arguments, correct?  I.e., would it be better for SoapFault
have a constructor that takes just an SOAPFaultException and let it
internally determine those first and third arguments?


> +            fault.setRole(sfe.getFault().getFaultActor());
> +            fault.setDetail(sfe.getFault().getDetail());
> +            
> +            return fault;
> +        }
> +        return super.createFault(ex);
> +    }
> +    
>      protected Object invoke(Exchange exchange, final Object serviceObject, Method m,
List<Object> params) {
>          // set up the webservice request context 
>          MessageContext ctx = 
> 
> Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java?rev=573017&r1=573016&r2=573017&view=diff
> ==============================================================================
> --- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
(original)
> +++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
Wed Sep  5 11:12:51 2007
> @@ -153,10 +153,16 @@
>                  if (ex instanceof SoapFault) {
>                      soapFault.setFaultString(((SoapFault)ex).getReason());
>                      soapFault.setFaultCode(((SoapFault)ex).getFaultCode());
> +                    soapFault.setFaultActor(((SoapFault)ex).getRole());
>  
>                      Node nd = soapFault.getOwnerDocument().importNode(((SoapFault)ex).getOrCreateDetail(),
>                                                                        true);
> -                    soapFault.addDetail().appendChild(nd);
> +                    nd = nd.getFirstChild();
> +                    soapFault.addDetail();


I'm not sure of the difference between the JavaSE SOAPFault and CXF's
SoapFault.  For SOAPFault, Sun seems to say that the above LOC would
not be allowed[1]: "It is illegal to add a detail when the fault already
contains a detail."

Still, what does addDetail() do, if you don't supply it an argument--I'm
having trouble locating this method within the CXF codebase so am
confused.

[1]
http://java.sun.com/javase/6/docs/api/javax/xml/soap/SOAPFault.html#addDetail()

Regards,
Glen


> +                    while (nd != null) {
> +                        soapFault.getDetail().appendChild(nd);
> +                        nd = nd.getNextSibling();
> +                    }
>   
>                  } else {
>                      soapFault.setFaultCode(new QName("http://cxf.apache.org/faultcode",
"HandlerFault"));
> 



Mime
View raw message